سؤال

I accidentally declared an array without a length by writing enum foo bar[];, and gcc gave me the warning "array 'bar' assumed to have one element".

Is there any way to make gcc turn this into an error, instead of just warning me and assuming I meant enum foo bar[1]? I can't think of any circumstances under which I'd purposely leave out an array's length.

هل كانت مفيدة؟

المحلول

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

You can use -Werror to turn all warnings into errors. I couldn't find an option to turn only that one into an error.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top