Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-09-19 16:37:30


On 9/19/05, Matthias Troyer <troyer_at_[hidden]> wrote:
>
> troy d. straszheim wrote:
>
> > Serialization of tuple. This will come in handy when revamping
> > serialization tests...
> >
> > http://svn.resophonic.com/pub/boost/boost/serialization/tuple.hpp
> > http://svn.resophonic.com/pub/boost/libs/serialization/test/
> > test_tuple.cpp
>
> Be careful with non-portable code like the following:
>
> char fieldstring[3] = "T?";
> fieldstring[1] = field_num + 48; // 48 is "0", and we are
> limited to 0-9
>
> This will only work in ASCII-encodings, and not e.g. on IBM machines
> using EBCDIC encodings.

Doesn't anyone who writes code like this write it as:

fieldstring[1] = field_num + '0';

for just this reason?

-- 
Caleb Epstein
caleb dot epstein at gmail dot com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk