incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: unable to use boolalpha stream manipulator in sourcepro ed9
Date Mon, 02 Oct 2006 20:02:24 GMT
Scott Zhong wrote:
> cat t.cpp && gcc  -D_RWCONFIG=12d -I../../include
> -I./../../../../include -I./../../../../include/ansi t.cpp
> 
> #include <iostream>

The boolalpha manipulator is required to be declared in the header
<ios> but in no other. Implementations are allowed to #include any
library headers in any other so while your code may compile with
some it's not portable. stdcxx does its best to avoid bringing in
more symbols into scope than necessary -- it's a feature of our
implementation and a portability bug in your code :)

Martin

> 
> using namespace std;
> 
>  
> 
> int main () {
> 
>   bool b;
> 
>   b=true;
> 
>   cout << boolalpha << b << endl;
> 
>   cout << noboolalpha << b << endl;
> 
>   return 0;
> 
> }
> 
> t.cpp: In function `int main()':
> 
> t.cpp:7: `boolalpha' undeclared (first use this function)
> 
> t.cpp:7: (Each undeclared identifier is reported only once for each
> function it 
> 
>    appears in.)
> 
> t.cpp:8: `noboolalpha' undeclared (first use this function)
> 
>  
> 
> problem first appeared when using sourcepro ed6 and also appears true
> for ed9.
> 
>  
> 
> Yu (Scott) Zhong
> 
> 


Mime
View raw message