I use it all the time in my coding.
The -ansi
flag is equivalent to -std=c89
. As noted, it turns off some extensions of GCC. Adding -pedantic
turns off more extensions and generates more warnings. For example, if you have a string literal longer than 509 characters, then -pedantic
warns about that because it exceeds the minimum limit required by the C89 standard. That is, every C89 compiler must accept strings of length 509; they are permitted to accept longer, but if you are being pedantic, it is not portable to use longer strings, even though a compiler is permitted to accept longer strings and, without the pedantic warnings, GCC will accept them too.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…