This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request for a C++ warning for undefined behaviour

skaller <> writes:

| On Wed, 2003-08-13 at 23:05, Gabriel Dos Reis wrote:
| > skaller <> writes:
| > 
| > Well, initialization within the member-initalizer list is taught to be 
| > good style; and initialization within the constructor body is also
| > "known fraught with errors".
| Yes, I agree. But my point refered to complex calculations.
| So again please don't quote out of context: I said that if
| I have to do a complex calculation, it goes in the body,

Here we go

  >  Besides, usefullness lies in the eye of
  > the beholder.  Indeed from your above remarks I would conclude that this
  > warning would also be useful to you, because you already made an error in
  > your assumptions, namely that you can call non-virtual members.

  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.

  *If I have to do any calculations, they go in the body,*
  and I have to ask myself how I ended up with that,
  because it's symptomatic of a design fault.

I don't consider that quote out of context.


| > | >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:
| > 
| > We have no evidence that the garbage was deliberately being put in.
| > That can come from ignorance also.
| That doesn't change anything. I'm not claiming someone tried
| to deliberately sabotage the code! I'm saying that they
| wrote the code the way they did on purpose.

if they did that way on purpose, then it was deliberate.  But my point
was that maybe the code was written that way because of no clue.
In fact, I tend to find errors like that one in C++ codes written by
people with strong Java background and relatively less practice in C++.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]