From: Dan Nuffer (dnuffer_at_[hidden])
Date: 2001-06-30 14:09:38
Samuel Krempp wrote:
> > I like the function approach, mostly because that's what I've been using for
> > the last 6 months :-) I think that the code just looks more obvious with
> > what it's doing. It's also easy to learn and understand. I also see the
> okay, I can imagine you're used to it by now.
> But :
> cout << format(" $1 $2 $3", x, y, z) << endl;
> cout << format(" $1 $2 $3") %x %y %z << endl;
But what about:
logMessage(format("Error: $1", errStr));
logMessage((format("Error: $1") % errStr).str());
The second one just looks weird. Now, imagine someone who is not
familiar with the format class, comes along and needs to maintain the
code. I think the first version is easier to understand, the second
version, they will think, "What does that % do?!?"
To quote from the proposed boost coding guidelines: "13.2. Operator
overloading should reflect recognizable idioms."
I think I'm safe saying that most people understand % to mean modulus.
> once you know what this funny % operator does here, both forms are very,
> very similar, aren't they ?
Yeah, it just the "funny % operator" that I don't like.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk