showpos bug in libstdc++

Betty Evans bevans@ittvis.com
Tue Nov 27 00:11:00 GMT 2007


I believe I have found a bug with libstdc++ but am unsure where to log
the bug on GNU.  I cannot test this on other systems because of
installation privileges.  I do know that other compilers/libraries like
Visual Studio and Sun Forte Developer do not exhibit the error.
 
 
Bug:
showpos will not put a plus sign before an int 0 but will put one in
front of a float 0.
 
 
Code:
#include <iostream>
using namespace std;
 
int main()
{
  signed int i = 5;
  cout << "Correct: int 5 showpos =     " << showpos << i << endl;
 
  i = 0;
  cout << "Error:   int 0 showpos =     " << showpos << i << endl;
 
  float d = 0.0;
  cout << "Correct: float 0 showpos =   " << showpos << d << endl;
  
  return 0;
}
 
 
Build Command (generated automatically by eclipse):
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/showpos.d"
-MT"src/showpos.d" -o"src/showpos.o" "../src/showpos.cpp"
 
 
Output
Correct: int 5 showpos =     +5
Error:   int 0 showpos =     0
Correct: float 0 showpos =   +0
 
Thanks
Betty Evans



More information about the Libstdc++ mailing list