Boost logo

Boost :

From: Bo Persson (bop2_at_[hidden])
Date: 2003-05-02 12:20:14


"Noel Yap" <Noel.Yap_at_[hidden]> skrev i meddelandet
news:3EB24FF9.4AC0C527_at_morganstanley.com...
> Bo Persson wrote:
> > Having gone from C with pointer parameters and hungaring notation to C++
> > with const reference, a function call has changed from
> >
> > display(&sz_name);
> >
> > to
> >
> > display(name)
> >
> > which I personally find *soo* much better.
> >
> > You now suggest that I should write this
> >
> > display(out(name))

Duh! Thinking about output, I wrote 'out' when meaning 'in'...

Is that a good or a bad sign?

> >
> > which I don't find *any* improvement at all.
>
> I don't know about anyone else, but I would think that:
>
> display( name );
>
> would /not/ change the variable name.

Exactly, it would display the name.

> OTOH:
>
> display( out( name ) );
>
> is much more clear.

Except that it is not what was intended on my part...

>
> To assuade those that still think there may be ambiguity, what about
> 'in'?
>
> display( in( name ) );
>
> If you see parameters with no qualifiers, it's ambiguous, otherwise,
> it's extremely clear.

Unless you mistype the qualifier...

My point was (should have been?) that you can choose names so that they tell
you what is going on. There should be no need to add extra qualifiers to
point out what you really intended.

Bo Persson
bop2_at_[hidden]


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