Gcc warning variably modified at file scope
PolarBear PolarBear 5 5 silver badges 12 12 bronze badges. The 'const' keyword in C does not really mean 'constant'. This misleads some users. Lowpower I agree - this is a detail of the implementation. Scott Franco Scott Franco 1 1 silver badge 12 12 bronze badges.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 2. See more linked questions. Related Hot Network Questions. Active 3 years, 4 months ago. Viewed times. Improve this question.
Jonathan Leffler k gold badges silver badges bronze badges. Sarah Connorh Sarah Connorh 23 5 5 bronze badges. C90 did not support variable length arrays at all; C99 does support them, but they must defined within a function; C11 provides conditional support for variable length arrays. I'm talking about C89, but my compiler is definitely c Add a comment. Active Oldest Votes. Improve this answer. Or an enum — see also static const vs define vs enum. Hey thx for answer me.
SarahConnorh The above should work. But if you keep static as well as initialization the still will be error. But if you remove initialization and keep static the below error will come. GCC does not seem to allow this const is interpreted as read-only See explanation in this thread: "Initializer element is not constant" error for no reason in Linux GCC, compiling C.
Email: [email protected]. Related Url.
0コメント