Re: The dreaded segfault
On Oct 17, 8:52 am, Ian Collins <ian-n...@hotmail.com> wrote:
Stephen Horne wrote:
[...]
gcc 4 will give the required diagnostic if you invoke it in a
conforming mode:
g++ /tmp/x.cc -ansi -pedantic
/tmp/x.cc: In function 'int main()':
/tmp/x.cc:11: error: ISO C++ forbids variable-size array 'successors'
That works, but if I understand correctly, the exact meaning of
-ansi may change in time. A more precise replacement would be
-std=c++98.
In practice, with any compiler, you'll need a lot of options for
everyday use. For g++ under Solaris, for example, I use:
$ echo $GppFlags
-std=c++98 -pedantic -ffor-scope -fno-gnu-keywords -foperator-
names -pipe -Wall -W -Woverloaded-virtual -Wno-sign-compare -Wno-
deprecated -Wno-non-virtual-dtor -Wpointer-arith -Wno-unused -Wno-
switch -Wno-missing-braces -Wno-long-long -static-libgcc -ggdb3 -
D_GLIBCXX_CONCEPT_CHECKS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
$ echo $GppOFlags
-std=c++98 -pedantic -ffor-scope -fno-gnu-keywords -foperator-
names -pipe -Wall -W -Woverloaded-virtual -Wno-sign-compare -Wno-
deprecated -Wno-non-virtual-dtor -Wpointer-arith -Wno-unused -Wno-
switch -Wno-missing-braces -Wno-long-long -static-libgcc -O3 -fomit-
frame-pointer -finline-functions
I'm not sure that all of them are (still) necessary, and I'm
probably missing a few useful ones because I use the same
environment variable with older versions of g++. (Note too that
at least one of the options, -Wno-long-long, is there to turn on
an extension.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34