g++ just exits without any message, egcs-970910 and egcs-970907
Joe Buck
jbuck@synopsys.com
Fri Sep 12 09:04:00 GMT 1997
> Is an enum supposed to be 'compatible' with a 'int' or not in C++?
No (or rather, only in one direction), this is a difference between C and
C++. In C, enums are really just ints for all practical purposes.
In C++, an enum can be automatically converted to an integral type, but
you can't assign anything to an enum but an enum of the same kind (without
a cast).
For this reason, several large C projects (including the Linux kernel)
have put their code through a C++ compiler to make sure that enums are
used in a type-safe manner (a C compiler won't complain if you use the
wrong enum type, or an int for an enum argument, though some do produce
warnings for some cases).
This does bring up a point: in the past, g++ was quite sloppy and would
accept protection violations, type mismatches, etc and this has gradually
been tightened up. This process has continued in 2.8.0/egcs, and users
will report these as bugs.
More information about the Gcc
mailing list