Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-07-10 14:36:58


At 12:44 PM 7/10/2001, Michael Kenniston wrote:

>Ronald Garcia wrote:
>
>> Peter Dimov writes:
>> >
>> > "15.6. Keep in mind that the compiler will implicilty generate a
copy
>> > constructor, assignment operator and a destructor if you don't
declare
>them
>> > explicitly. If you rely on this behavior, document it using a
comment
>inside
>> > the class body:
>> >
>> > // implicitly generated members are fine and useful
>> > "
>>
>> I dont think one should have to state that the implicitly generated
>> members are okay. I'd say that the absence of either
>> boost::noncopyable or the private declaration of components would say
>> enough. This comment seems to go against the grain of the language.
>>
>> ron
>
>I disagree. The cost of including the comment is close to zero.
>The cost of /not/ including it is the time (at least a minute, and
possibly
>much longer) that a programmer unfamiliar with the code has to spend
>to decide if the omission of the ctor/assign/dtor was deliberate or
>accidental.
>With a comment, the question is answered -- definitively -- in a second
or
>two.
>
>In other words, you are quite correct that the comment is not required to
>specify the program's behavior, but given how easy it is to goof this up,
>I think the comment is useful to specify whether that behavior is
>intentional.

I agree with Michael. A comment specifying in effect that "compiler
generated functions are expected and useful" can be a big help.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk