Caution required with integer conversions Wednesday 2nd January 2008 Comments Off on Caution required with integer conversions
This applies to both C and C++, although the details are a little different in the more obscure corners. Consider this C++ snippet which is designed to position a streambuf somewhere a bit before its end: pos = sb->pubseekoff( -128 – thing.GetSize(), ios_base::end, ios_base::in ); How did this fail spectacularly? OK, here are the types. […]