From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] psql vs. gcc |
Date: | 1999-12-17 17:24:01 |
Message-ID: | 8312.945451441@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1999-12-17 17:36:55 | Re: [HACKERS] LONG varsize - how to go on |
Previous Message | Thomas Lockhart | 1999-12-17 17:21:57 | Re: [HACKERS] Oracle Compatibility (Translate function) |