It's not always that easy to give a function a name that will tell you at invocation time which of it's parameters it's planning on changing, and, it would be hard to tell people through just a function name that a parameter is an in/out parameter.
As for a function returning a single param, I agree, normally you'd just return it, UNLESS it's some big structure you don't want being copied all over the place, then passing it by reference to a function makes more sense. Or, in the case I originally created this for, I had a function that initialized an object to begin a transaction, I wanted to pass an object into my function, and have it properly initialized to start a transaction. Anyway, in that case, InitRequest makes it pretty clear that the object being passed is going to be modified, but by making it a c_out param, there's NO question, it's explicit at the invocation. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bo Persson Sent: Wednesday, April 23, 2003 11:32 AM To: [EMAIL PROTECTED] Subject: [boost] Re: Re: class proposal "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 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost