What is the default `fill character` of std::stringstream?

Viewed 1344

Is it implementation defined or standards suggest a default fill character for streams?

Sample code:

#include <iostream>
#include <iomanip>
#include <sstream>

int main ()
{
    std::stringstream stream;
    stream << std::setw( 10 ) << 25 << std::endl;

    std::cout << stream.str() << std::endl;
}

With clang++ --stdlib=libstdc++

$ clang++ --stdlib=libstdc++ test.cpp
$ ./a.out | hexdump
0000000 20 20 20 20 20 20 20 20 32 35 0a 0a
000000c
$

With clang++ --stdlib=libc++

$ clang++ --stdlib=libc++ test.cpp
$ ./a.out | hexdump
0000000 ff ff ff ff ff ff ff ff 32 35 0a 0a
000000c

Version

$ clang++ --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

I was able to fix it with std::setfill(' '), but am curious to know if it is a clang bug.

1 Answers
Related