|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2003-10-24 15:27:58
From: Pavol Droba <droba_at_[hidden]>
> On Wed, Oct 22, 2003 at 06:09:11PM +0200, Mickael Pointier wrote:
> > Pavel Vozenilek wrote:
> > > I vote to include string_algos into Boost.
> > >
> > > Few issues that may get considered:
> > >
> > > 1. Usual order of function parameters is "in, in-out, out".
> > >
> > > Many functions here have "out" parameters first. This is error
> > > prone and there's no way to check it automatically.
> > > [...]
> >
> > I just would like to know what you exactly meant by "usual order of function
> > parameters is "in, in-out, out"" ?
> >
> > I was thinking exactly the opposite, I'm used to use functions that
>
> You are quite right, printf is a briliant example for this. In the string_algo
> library, there are algorithms with some default parameters. Those are always "in"
> parameters and because of C++ syntax, they have to be specified at the end.
>
> If an output parameter would be somewhere ofter the "in" parameters,
> the signature of a function would look like
>
> foo( in, in, out, default-in, default-in );
>
> What I find worse thenthe current convention.
I always put output parameters first.
Ideally, you want a conventional place to put them, so you have
to choose one end or the other. You can cite various precedents
for both positions. Putting them first allows for defaulted
arguments, so that's what dictates my convention.
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk