This is the mail archive of the
mailing list for the GCC project.
Re: Request for a C++ warning for undefined behaviour
On Wed, 2003-08-13 at 22:22, Gabriel Dos Reis wrote:
> skaller <firstname.lastname@example.org> writes:
> | No, I don't agree. It is certainly possible to be coding
> | in a good style and make an honest mistake.
> "honest mistake" is meaningless.
It means "you were trying to do the right thing,
but typed something wrong by accident".
"you are using a practice which is known
to be fraught with errors"
There really is something called "good design"
and "bad design" even though it isn't so easy
to say exactly what it is in most cases.
In some cases, there are very definite measurements,
however. For example, for the design of a type system
there is a property known as "soundness" which can be
used to evaluate the utility of the system.
> | Nope, I'd never use a ctor-initialiser to initialise a variable
> | or base other than with a parameter to the constructor, or, at worst,
> | a component of a structure.
> But not every member is default constructed.
So what? If the member isn't default constructed,
AND i need to do a calculation to initialise it,
there is a design error somewhere in there.
> You have a particular
> coding style. Fine. But I see no reason to force people to follow
> one signle style. In particular, initializing member in the
> member-initializer-list does make sense.
Of course it does. Initialising it with a complex
expression, however, is just bad coding practice,
or, if it seems necessary, bad design.
> Of course, if you put in
> gardage, you get garbage out. Matt was asking for a flag that would
> assist him to detect when a garbage is inadvertently being put in.
>From the example I conclude otherwise. I conclude Michael
is asking for the flag to help detect garbage within garbage
which was *deliberately* put in, and my reaction is:
it hardly seems worthwhile trying to help people sort out
their garbage when they're supposed to be programming.
They ought to learn how to program at school, it isn't
gcc's job to teach them: its a compiler, not an interactive
This comment refers to the original coder and NOT to
Michael, who appears to have been stuck with having to fix it.