[test] 64-bit compatibility problem

The file boost/test/impl/debug.ipp contains the function prepare_window_title, which contains this line (317): ::snprintf( title_str, sizeof(title_str), "%*s %ld", dsi.binary_path.end()-it, it, dsi.pid ); There are two potential problems here. One, the length specification of "%*s" must be an int, but the difference_type of the iterator is ptrdiff_t, which is a long int. That's a different size on a GCC-compiled 64-bit system and will cause problems. Two, is it safe to say that basic_cstring::iterator (the type of 'it') will always be a pointer? No debug iterator will ever be used? Sebastian Redl

"Sebastian Redl" <sebastian.redl@getdesigned.at> wrote in message news:4735AFCB.7020004@getdesigned.at...
The file boost/test/impl/debug.ipp contains the function prepare_window_title, which contains this line (317):
::snprintf( title_str, sizeof(title_str), "%*s %ld", dsi.binary_path.end()-it, it, dsi.pid );
There are two potential problems here. One, the length specification of "%*s" must be an int, but the difference_type of the iterator is ptrdiff_t, which is a long int.
I've added explicit cast to int
That's a different size on a GCC-compiled 64-bit system and will cause problems. Two, is it safe to say that basic_cstring::iterator (the type of 'it') will always be a pointer? No debug iterator will ever be used?
This is true for now. And I do not have plans to change it. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Sebastian Redl