I have a question about standard call behavior tellpon empty ostringstream. I have a foo function that calls the tellpfirst:
void foo(std::ostream& os)
{
std::ostream::pos_type pos = os.tellp();
}
int main()
{
std::ostringstream os;
foo(os);
}
In Visual Studio 2005, calling this function with the newly created and empty ostringstreamcauses the variable posto be set to invalid pos_type, which in Visual Studio 2005 is set to pos_type(_BADOFF).
ofstreamdoesn't have the same behavior where tellpreturns pos_type(0), which is valid pos_type.
Is this a standard match? Is this consistent with other compilers?
dalle source
share