[Exceptional C++ Style] Exceptional C++ Style - Item 24:ConstantOptimization

Paul Grenyer paul at paulgrenyer.co.uk
Tue Jan 25 10:46:10 EST 2005


Hi

> I suspect you're talking at cross purposes.  Documentation of what the
> function does is valuable.  Documentation of whether it modifies an
> argument can be considered optional, in the normal (99.9%) case where
> you can tell that from looking at the parameter type.

Maybe. The problem is maintaining the documentation acurately.

> > A function is a method of encapsulation like any other. I don't care
> > what
> > happens inside as long as I get the desired result.
>
> Which you know from the documentation, only.

I disagree. If the function has a well chosen name and is considered in the
context of it's class/namesapce/etc they is _should_ be clear what it does.
Obviously I am describing an ideal world.

> > If the function name and parameter names are clear
> > and well chosen it should also be possible deduce what the
> > modification will
> > be.
> >
> In all boundary cases?

Probably not. It's another ideal world thing.

Regards
Paul

Paul Grenyer
email: paul at paulgrenyer.co.uk
web: http://www.paulgrenyer.co.uk
articles: http://www.paulgrenyer.dyndns.org/articles/

"15 miles to the love shack...."




More information about the Effective-cpp mailing list