[Exceptional C++ Style] Exceptional C++ Style - Item 24: Cons tantOptimization

David Nash David.Nash at WallStreetSystems.com
Tue Jan 25 04:39:15 EST 2005


> > True but it can be useful documentation for the caller.
> 
> Come again?  You see in a header:
> 
> void foo1(int param);
> void foo2(const int param);
> 
> As a caller what information can you deduce from that const?

OK, I was thinking more about passing by reference.

void foo (int& param); //param *might* get modified
void foo (const int& param); //param won't get modified

Although I would prefer to see "proper" documentation of
what a function is supposed to do, than have to deduce it from
the signature.

Dave





More information about the Effective-cpp mailing list