Bug 166736 - std::showbase fails for hex value 0
Summary: std::showbase fails for hex value 0
Keywords:
Status: CLOSED DUPLICATE of bug 166735
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: 4
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-08-25 02:19 UTC by D. Stimits
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-08-25 02:43:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description D. Stimits 2005-08-25 02:19:26 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Description of problem:
std::showbase combined with std::hex in <iostream> fails to show the base if the value is 0. The following program should produce "0x0" as the output in all lines which start with:
std::cout << std::hex << std::showbase...

Instead this program produces output "0", skipping the "0x" base.

// main.cxx
#include <iostream>

int main()
{
   unsigned int var = 0;
   std::cout << var << "\n";

   // This is a failure line, it outputs "0" instead of "0x0".
   std::cout << std::hex << std::showbase << var << "\n";

   var = 1;
   std::cout << var << "\n";
   std::cout << std::hex << std::showbase << var << "\n";

   return 0;
}


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Use std::hex and std::showbase in a std::cout, then feed 0 to the stream.
  

Actual Results:  Outputs "0".

Expected Results:  Outputs "0x0".

Additional info:

gcc-c++-4.0.1-4.fc4

Comment 1 D. Stimits 2005-08-25 02:43:01 UTC
Looks like bugzilla figured out how to double submit this one for me. This is a
duplicate of 166735 which I did not submit.

*** This bug has been marked as a duplicate of 166735 ***


Note You need to log in before you can comment on or make changes to this bug.