This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: PCH bug, cont'd
- From: Jon Salz <jsalz at mit dot edu>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Jan 2003 15:27:22 -0500 (EST)
- Subject: Re: PCH bug, cont'd
On Tue, 28 Jan 2003, Paolo Carlini wrote:
> > Another way to reproduce the PCH bug is to change '\n' to endl in the
> > g++.dg/pch testsuite.
>
> This is, unfortunately, a known issue: other/9274.
>
> > The rather unusual way that this is written (who writes a separate '\n'
> > instead of an endl?)
>
> This is _not_ at all obvious: endl outputs a newline _and_ additionally
> flushes the output buffer: for efficiency sake the indiscriminate use of
> endl is discouraged in any good book about the C++ standard library.
True! I just meant that every "Hello, world" program I've ever seen uses
endl, and that if you were going to write out a \n instead you'd just
stick it in the string rather than writing out a separate \n. No matter.
Anyway, it seems you can work around the bug, at least in this instance,
by including a dummy function in the header file like so:
inline void foo() { std::cerr << std::endl; }
I'm not nearly smart enough to find a real solution, which probably
involves fixing a missing find_substitution somewhere...
- Jon