Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2003-06-03 02:19:09


Hi,

On Monday 02 June 2003 19:21, Ed Brey wrote:
> * newl differs from '\n' only in that newl doesn't perform background
> formatting. Presumably one would choose to use newl to avoid the
> formatting. What is undesirable about '\n' being formatted?

To me there are basically two reasons that make newl desirable beside the
formatting issue.

1. std::endl was and is still abused heavily. I think there is a reason for
this. Most c++ programmers are taught to stay clear of ugly low-level c
things and to use the new shiny c++ facilities instead. And that's what they
do, replace '\n' with std::endl. Personally I believe this reason alone
justifies a std library extension std::newl.

2. IIUC the difference between a character and a manipulator is that the
manipulator is not tied to the streams character type. So for some
applications '\n' does not suffice. To me stream.widen('\n') is sufficiently
ugly to justify a newl modifier.

Thomas

-- 
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de

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