Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-10-22 11:43:58


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.
> > [...]
>
> Homogeneity in an interface is important, that's right.
>
> 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
> manipulate strings, filenames, memory, ... and they often have the
> destination as a first parameter, followed by the source(s). I suppose it
> originates from variable argument number functions like the printf family
> that obviously create a single destination string by concatenating/parsing a
> list of arguments.
>
> Things like "cout" follow the same logic, and operators (a=b+c) also have
> this right to left direction :)
>
> Mickael Pointier
>
> PS: I may be totaly missing your point, I admit I have not the time to read
> all the mails of the list.
>

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.

Regards,

Pavol


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