Re: [HACKERS] psql vs. gcc
| От | Tom Lane |
|---|---|
| Тема | Re: [HACKERS] psql vs. gcc |
| Дата | |
| Msg-id | 8312.945451441@sss.pgh.pa.us обсуждение |
| Ответ на | psql vs. gcc (Karel Zak - Zakkr <zakkr@zf.jcu.cz>) |
| Ответы |
Re: [HACKERS] psql vs. gcc
|
| Список | pgsql-hackers |
Karel Zak - Zakkr <zakkr@zf.jcu.cz> writes:
> strcpy(buf,
> "SELECT pg_database.datname as \"Database\",\n"
> " pg_user.usename as \"Owner\""
> #ifdef MULTIBYTE
> ",\n pg_database.encoding as \"Encoding\""
> #endif
> );
> What is bad, my gcc or previous source code? (IMHO is Peter's code right and
> gcc is a little mazy).
After looking at my C reference, I believe gcc is following the ANSI C
spec and Peter's code is broken. According to the book I'm looking at,
concatenation of adjacent string literals is specified to happen while
forming preprocessing tokens, which obviously must occur *before*
preprocessor directives are evaluated. (#if throws away preprocessing
tokens, not raw characters...) So when MULTIBYTE is defined, an
ANSI-compliant compiler will see a syntax error in the above.
> describe.c:324: warning: preprocessing directive not recognized within macro arg
Looks like there are a few other problems here too...
regards, tom lane
В списке pgsql-hackers по дате отправления: