Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 167367 - std::showbase fails for hex value 0
std::showbase fails for hex value 0
Status: CLOSED DUPLICATE of bug 166735
Product: Fedora
Classification: Fedora
Component: gcc4 (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2005-09-01 17:50 EDT by D. Stimits
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-02 02:41:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description D. Stimits 2005-09-01 17:50:22 EDT
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:

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:

Comment 1 Jakub Jelinek 2005-09-02 02:41:19 EDT

*** 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.