"Justin M. Lewis" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Not entirely, passing a pointer doesn't tell you that the parameter will
> change, it just tells you that it might, it still leaves you in the
position
> of having to track down the function and check it.  But outside of that,
if
> you're like me, at this point you prefer references to pointers, whenever
> possible.

The obvious solution is of course to name the function so that you can tell
what is does! :-)

A function returning a single value, should really RETURN the value and not
update a parameter:


y = year_of_first_marriage();


Having a function lying about its purpose should be caught at its
definition, not at each call of the function:

void will_never_change_any_parameters_honest(int& x) { x = 7; }

is easy to catch early. :-)



Bo Persson
[EMAIL PROTECTED]



>
> ----- Original Message -----
> From: "Vincent Finn" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, April 23, 2003 2:09 AM
> Subject: [boost] Re: class proposal
>
>
> > >
> > > void func(int &x){x = 1977;};
> > >
> > > void blah()
> > > {
> > >   int y=0;
> > >   func(y);
> > >   func2(y);
> > >   printf("%d\n", y);
> > > }
> > >


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to