This is the mail archive of the gcc-help@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]

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


On 05/08/2015 10:22 AM, m-h-l wrote:

> What can be more constant than  "12345"[3] ?

It's not a constant because the C language specification says it's not
a constant.  We could treat it as a constant in GCC, but then our
compiler would be wrong according to the specification of the
language.  We don't get to just make stuff up.

Andrew.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]