Re: gcc: why is "abcdef"[3] not a constant (error: initializer element is not constant)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I guess you refer to this part of the standard:

"The array-subscript [] and member-access . and -> operators, the address &
and indirection * unary operators, and pointer casts may be used in the
creation of an address constant, but the value of an object shall not be
accessed by use of these operators."

Funny thing is that g++, ArmC and ICC do not have a problem with "abcdef"[3]
as an initializer.
So I wonder what shall be the sense to forbid this in gcc.
This way I cannot use gcc to calculate e.g. CRCs or Hashs over real constant
things at build time without extra tools, even not in such a clear case as
here. With the other compilers its no problem.

What a pity!



--
View this message in context: http://gcc.1065356.n5.nabble.com/gcc-why-is-abcdef-3-not-a-constant-error-initializer-element-is-not-constant-tp1146945p1147037.html
Sent from the gcc - Help mailing list archive at Nabble.com.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux