This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
After playing a bit with macros, I came to some construct I don't fully
understand (or gcc does something bad with it. Here's my testcase:
int a = "hello"[2]; /* #1 */
int main() {
int b = "again_hello"[5]; /* #2 */
return 0;
}
Assignment #2 is okay from GCC's eyes, but #1 isn't:
t2.c:2: initializer element is not constant
Sure, what I try is "uncommon" (to the best), but I think that
'"hello"[2]' is a constant value which could be examined. For the
curious, gcc accepts this construct for the second assignment...
The behaviour is the same with gcc-2.95 and gcc-3.0.
MfG, JBG
--
Jan-Benedict Glaw jbglaw at lug-owl dot de . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur
fuer einen Freien Staat voll Freier Bürger" | im Internet!
Shell Script APT-Proxy: http://lug-owl.de/~jbglaw/software/ap2/
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |