Re: [HACKERS] taking stdbool.h into use
От | Michael Paquier |
---|---|
Тема | Re: [HACKERS] taking stdbool.h into use |
Дата | |
Msg-id | CAB7nPqRrX0iKqpSH7pcV9tkAH+mL1gRc+qK1JhV5aR+DtG919A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] taking stdbool.h into use (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Thu, Oct 26, 2017 at 5:41 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > While warnings for this would be lovely, I don't see how we can expect to > get any. This is perfectly correct C code no matter whether isprimary > is C99 bool or is typedef'd to char ... you just end up with different > values of isprimary, should the RHS produce something other than 1/0. > The compiler has no way to know that assigning, say, 4 in the char > variable case is not quite your intent. Maybe you could hope for a > warning if the bit value were far enough left to actually not fit into > "char", but otherwise there's nothing wrong. This reminded me of https://www.postgresql.org/message-id/20160212144735.7zkg5527i3un3254%40alap3.anarazel.de which has caused commit af4472bc when using stdbool.h for MSVC 2013/2015 builds. So I would really assume that there are places where we could see warnings. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления: