Issues warnings required by strict compliance to the ISO standards for C and C++. Without this option the GNU extensions are enabled, but ISO compliant programs should compile successfully (although some may require the -ansi option).
For C, the standard applied is the one specified by the -std option. If-std is used to specify gnu89, then -pedantic applies the rules for C89. The -pedantic option issues only the diagnostic messages required by the ISO standard, so it is possible for code that does not comply with the standard to compile without a warning. There are no plans for GCC to implement an option that would force strict standards compliance.
For C, the -pedantic option does not apply to any expression following _extension_.
For C++, if nether the -fpermissive nor the -pedantic option is specified, the -fpedantic-errors option is assumed.
For Fortran, warnings are issued for uses of extensions to Fortran 77. Warnings are issued for C-like constructs in character constants (such as \n). Warnings are issued for certain GNU language extensions and some traditional Fortran features, but valid Fortran 77 should compile properly with or without this option. It should be noted, however, that this option does not force the program to strictly adhere to the standard.
This option can be written --pedantic.
Was this article helpful?