Re: strange problem with send() and recv()
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Sun, 14 Aug 2005 17:32:19 GMT
Dave Thompson <david.thompson1@xxxxxxxxxxxxxxxx> writes:
[...]
> As others have noted the STL part is C++ and offtopic in c.l.C, but
> this is relatively small and easily ignorable. "Mixed" declarations
> (that is, not solely at the beginning of a block) and double-slash
> comments which were introduced in C++ _are_ standard in C as of C99,
> but not yet universally implemented. And double-slash comments are
> still unwise in news postings, since those may get line breaks (wraps)
> added at various points, and this breaks // comments but does not harm
> /* */ comments. (It also harms long preprocessor #directives, the only
> other place lines are significant.)
Lines are also significant in string literals. E.g., "splitting this
across lines" will cause problems.
[...]
> In general it's a poor idea to send C-language structs over a network;
> compilers on different types of systems can lay them out differently,
> and sometimes also different compilers or the same compiler with
> different options on the same system type. This is why you see proper
> network protocols specified in terms of actual bits (or nowadays
> usually octets) on the wire and not in C or other HLL. But since you
> apparently are using Wintel and probably the same compiler at both
> (all) endpoints, and structs that are _mostly_ chars, leave that also.
It's not uncommon for structs to be laid out in the same way for
different compilers on the same platform, so there's some hope of
combining code compiled with different compilers, but generally it's
not wise to depend on it.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- strange problem with send() and recv()
- From: Tom
- Re: strange problem with send() and recv()
- From: Dave Thompson
- strange problem with send() and recv()
- Prev by Date: Re: compiling a hope interpreter
- Next by Date: Re: [ot] allocation
- Previous by thread: Re: strange problem with send() and recv()
- Next by thread: how can i store huge values?
- Index(es):
Relevant Pages
|