Alexander Aliev
2008-05-08 20:44:55 UTC
Hi,
I get Stack Overflow error on the following statement:
...
Log << Now();
...
There are following definitions:
class logstream : public ofstream {...}; // no redefinition for <<
...
logstream Log;
When debugging I enter in sysclass.h :
// TDateTime IOStream operators
//
inline std::ostream& operator << (std::ostream& os, const TDateTime& arg)
{
os << arg;
return os;
}
If I understand correctly then on statement os << arg program should
recursively call the same function and get stack overflow.
I use RAD2007 trial, but in BCB5 in this place I see
os << AnsiString(arg);
I suspected this is a bug, but when I try to repeat the situation
in small test program compiler gives error 'ambiguity between
... operator << (int) and ... operator << (double)' at that very line
Log << Now();
Could you suggest what I am doing wrong?
Thank you for any hint,
Akexander
I get Stack Overflow error on the following statement:
...
Log << Now();
...
There are following definitions:
class logstream : public ofstream {...}; // no redefinition for <<
...
logstream Log;
When debugging I enter in sysclass.h :
// TDateTime IOStream operators
//
inline std::ostream& operator << (std::ostream& os, const TDateTime& arg)
{
os << arg;
return os;
}
If I understand correctly then on statement os << arg program should
recursively call the same function and get stack overflow.
I use RAD2007 trial, but in BCB5 in this place I see
os << AnsiString(arg);
I suspected this is a bug, but when I try to repeat the situation
in small test program compiler gives error 'ambiguity between
... operator << (int) and ... operator << (double)' at that very line
Log << Now();
Could you suggest what I am doing wrong?
Thank you for any hint,
Akexander