egcs / g++ conflicts c++ draft standard (i think)
Joe Buck
jbuck@synopsys.com
Fri Jul 24 18:32:00 GMT 1998
> Could please someone tell me where can i find a list of non
> standard c++ features supported by g++. Following are this 2 samples
> discovered because we have to port to WinNT and VC++5 don't compile
> this code.
You list the two most commonly used conflicts.
> -- Initialization of const data member inside class definition
> //conflicts Stroustrup: C++ Programming Language 3ed - 10.4.6.2
> class foo
> {
> ....
> const int qtd = 100;
> ....
> };
Note that the standard allows
class foo
{
static const int qtd = 100;
};
(as does g++) although many compilers don't yet implement it.
(Perhaps it is time for g++ to allow only 'static', or to at least
warn about other uses like this).
> -- Dynamic allocation of array bounds (no const bounds)
That's the other. The best way to port code like this to a standard
compiler is to change
int dynarray[size];
into
vector<int> dynarray(size);
95% of the time, this is all you need to do.
More information about the Gcc
mailing list