[sclug] g++ c++ question
Antony Bartlett
akb at akb.me.uk
Sat Oct 25 09:05:53 UTC 2003
Is it possible that the gcc command line option -pedantic-errors has somehow
become set (or perhaps has become the norm)?
http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00658.html
Using "new" or "malloc" (as per Simon's suggestion) is probably more
pleasing
(as long as you "delete" or "free" it when you're done, of course)
----- Original Message -----
From: "Tim Sutton" <t.sutton at reading.ac.uk>
To: <sclug at sclug.org.uk>
Sent: Thursday, September 11, 2003 3:14 PM
Subject: [sclug] g++ c++ question
> Hi
>
> I am working on the same code both at home and at work. Home computer
running
> a modified copy of knoppix, work computer running debian woody with
unstable
> updates.
>
> My project compiles fine at home and on a wind###s pc here at work running
> bloodshed dev-cpp (basically g++ based), but at work I get :
>
> dataprocessor.cpp:780: error: ISO C++ forbids variable-size array `
>
> The offending code snippet looks like this:
>
> int myArrayLengthInt = theClimateVector.size();
> float myClimateArray[myArrayLengthInt];
>
> I seem to have three g++'s on my desktop (the machne giving the compile
> error)! :
>
> aps02ts at appc61:~/public_html$ dpkg -l |grep g++
> ii g++ 3.3.1-2 The GNU C++ compiler.
> ii g++-2.95 2.95.4-17 The GNU C++ compiler.
> ii g++-3.3 3.3.2-0pre3 The GNU C++ compiler
>
> wheras on my home machine I have:
>
> aps02ts at timlinux:~$ dpkg -l |grep g++
> ii g++ 3.2.3-1 The GNU C++ compiler.
> ii g++-3.2 3.2.3-6 The GNU C++ compiler
>
> So I suppose the questions I have are:
> -------------------------------------------------------
> 1) Did gcc / g++ 3.3 introduce some incompatiblility / stricter standards
> checking that is affecting me?
> 2) Is there a way to turn this behaviou off in kdevelop / g++ ?
> 3) Failing 2), what do I need to do to get my code to conform? THe only
> examples I was able to find on google involved creating an array of
pointers
> or somesuch - which will be unpleasant and involve a lot of rewriting for
me
> to do.
>
> ---------------------------------------------------------
>
> Many thanks
>
> Tim
>
> --
> Tim Sutton
> BDWorld Middleware Programmer
> -------------------------------------------------------------------
> BiodiversityWorld Project
> Centre for Plant Diversity & Systematics
> School of Plant Sciences
> The University of Reading
> Reading, RG66AS, UK
>
> Web : www.bdworld.org
> Phone : +44-(0)118-378-6052
> Email : t.sutton [at] reading.ac.uk
> (email preferred method of correspondence)
> -------------------------------------------------------------------
> _______________________________________________
> sclug mailing list
> sclug at sclug.org.uk
> http://www.sclug.org.uk/mailman/listinfo/sclug
>
More information about the Sclug
mailing list