Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top