Re: Some architectures need "signed char" declarations
От | Doug Royer |
---|---|
Тема | Re: Some architectures need "signed char" declarations |
Дата | |
Msg-id | 3C3C7FE2.B7F45E56@Royer.com обсуждение исходный текст |
Ответ на | Some architectures need "signed char" declarations (Oliver Elphick <olly@lfix.co.uk>) |
Ответы |
Re: Some architectures need "signed char" declarations
|
Список | pgsql-hackers |
Tom Lane wrote: > > Doug McNaught <doug@wireboard.com> writes: > > Hmmm, according to my knowledge of C, 'c' should be an int here, as > > EOF is guaranteed not to collide with any legal char value. > > I agree with Doug: EOF is not supposed to be equal to any value of > 'char', therefore changing the variables to signed char will merely > break something else. Probably the variables should be int; are their > values coming from getc() or some such? Will look at it. I deleted the original post, but I think the issue was signed versus unsigned comparisons. I think he was saying the variable should be explicitly declared as 'signed int' (or signed char) and not 'int' (or char) because EOF is (-1). unsigned int foo; if (foo == -1) ... causes a warning (or errors) on many compilers. And if the default for int or char is unsigned as it can be on some systems, the code does exactly that. Perhaps he is just wanted to reduce the build time noise? Apologies if this was not on point.
Вложения
В списке pgsql-hackers по дате отправления: