Code review comment for lp://qastaging/~kaaveeacs/drizzle/privatized-members-of-NestedJoin

Revision history for this message
Olaf van der Spek (olafvdspek) wrote :

On Mon, Apr 18, 2011 at 7:31 PM, Monty Taylor <email address hidden> wrote:
> Unless I'm wrong, I'm pretty sure those members are going to be default
> initialized whether they are listed in the initializer list or not. No?

Yes. But since those members would normally not be listed, it looks
like something else is happening.

>>> It's one of the things that makes us special and fun!
>>>
>>> In the case of this particular warning, if we could get to the point
>>> where we could enable it, warning about missing data members in
>>> initialization list can help to catch things that you forgot to
>>> initialize. It also warns about classes with pointer members which don't
>>> define a copy constructor or an operator= - which is quite dangerous.
>>
>> Not really, unless it's a ptr to a resource owned by that class.
>
> Yup - but the compiler doesn't know the difference, and it certainly
> doesn't hurt to define a copy ctor - so as a rule of thumb, having the

It does. More code, more complexity, higher chance of bugs. It might
also be slower.

> compiler to remind you to define one when you have a pointer data
> members doesn't hurt and is a safeguard against a potentially bad mistake.

Since such mistakes cause a sure crash the mistake is easily detected anyway.

Olaf

« Back to merge proposal