C and C++ standards using in GCC

naveen yadav yad.naveen@gmail.com
Thu Jun 3 14:06:00 GMT 2010


Hi All,


I want to know which  C / C++ standard my gcc is supported, Is there
any method to find ?


>From below site, they say C standard is ‘gnu90’, and C++ standard is ‘gnu++98’.

http://gcc.gnu.org/onlinedocs/gcc/Standards.html


Is it applicable to all gcc versions currently available?



If so,how can i check it.

I try using below method

[naveen@localhost ~]$ gcc -std=gnu99  test1.c -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--disable-libjava-multilib --with-cpu=generic
--build=i386-redhat-linux
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COLLECT_GCC_OPTIONS='-std=gnu99' '-v' '-mtune=generic'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 /usr/libexec/gcc/i386-redhat-linux/4.3.2/cc1 -quiet -v test1.c -quiet
-dumpbase test1.c -mtune=generic -auxbase test1 -std=gnu99 -version -o
/tmp/cc29vt4p.s
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.3.2/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i386-redhat-linux/4.3.2/include
 /usr/include
End of search list.
GNU C (GCC) version 4.3.2 20081105 (Red Hat 4.3.2-7) (i386-redhat-linux)
        compiled by GNU C version 4.3.2 20081105 (Red Hat 4.3.2-7),
GMP version 4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3bee52601079f736b7b63b762646f4ba
test1.c: In function âmainâ:
test1.c:4: warning: implicit declaration of function âtestâ
test1.c: At top level:
test1.c:7: warning: return type defaults to âintâ
COLLECT_GCC_OPTIONS='-std=gnu99' '-v' '-mtune=generic'
 as -V -Qy -o /tmp/ccu4rDxE.o /tmp/cc29vt4p.s
GNU assembler version 2.18.50.0.9 (i386-redhat-linux) using BFD
version version 2.18.50.0.9-7.fc10 20080822
COMPILER_PATH=/usr/libexec/gcc/i386-redhat-linux/4.3.2/:/usr/libexec/gcc/i386-redhat-linux/4.3.2/:/usr/libexec/gcc/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/4.3.2/:/usr/lib/gcc/i386-redhat-linux/:/usr/libexec/gcc/i386-redhat-linux/4.3.2/:/usr/libexec/gcc/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/4.3.2/:/usr/lib/gcc/i386-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/i386-redhat-linux/4.3.2/:/usr/lib/gcc/i386-redhat-linux/4.3.2/:/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-std=gnu99' '-v' '-mtune=generic'
 /usr/libexec/gcc/i386-redhat-linux/4.3.2/collect2 --eh-frame-hdr
--build-id -m elf_i386 --hash-style=gnu -dynamic-linker
/lib/ld-linux.so.2
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/4.3.2/crtbegin.o
-L/usr/lib/gcc/i386-redhat-linux/4.3.2
-L/usr/lib/gcc/i386-redhat-linux/4.3.2
-L/usr/lib/gcc/i386-redhat-linux/4.3.2/../../.. /tmp/ccu4rDxE.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed /usr/lib/gcc/i386-redhat-linux/4.3.2/crtend.o
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../crtn.o



so is above method correct. or is there any other method ?


Thanks.



More information about the Gcc-help mailing list