On Apr 30, 12:34 am, "Default User" <defaultuse...@yahoo.com> wrote:
> aki wrote:
> > i am receiving a buffer from network as char pointer.
> Pick a language. You multi-posted the same message to comp.lang.c.
Thanks for pointing that out. That way I can adjust my
responses, and not get chewed out by the C'ers for suggesting
e.g. std::vector.

.
As it happens, he has hit on a question where the basic issues
are the same in the two languages. C++ tries to be compatible
with C where POD structures are involved. (For those in clc: in
C++, a POD ("Plain Ordinary Data") structure corresponds, more
or less, to the subset of what you could write in C.) The rules
for padding, etc., are the same. And C++'s rules are exactly
the same concerning the representation of arithmetic types.
(Strictly speaking, not quite: the C++ rules correspond to those
in C90, which is, of course, out of date. But the next version
of C++ will be compatible with C99, and in practice, I don't
think it makes a difference here. C99's decision to limit
integer representations to 1's complement, 2's complement and
signed magnitude was, I believe, just a recognition that no
other conforming representations did exist.)
--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34