fread/fwrite Portability Issues

D

Dave Thompson

SM Ryan wrote:

Linking in more code that may or may not be around is a bad idea. Also
"long" need not be "sizeof == 4", and indeed isn't on many platforms.
True generally, but the sockets/POSIX standard {ntoh,hton}{l,s}
don't really mean 'long' and 'short'; they mean 'VAX long = IPv4 addr'
which is always 4 octets, and 'VAX short = IP port' which is always 2.
They are now actually defined (in POSIX/SUSv2) as uint{32,16}_t
from <stdint.h>, which is the fully-standard C99 way of saying this.

Once upon a time, briefly, enough of the world WAS a VAX.
(Somehow I feel like starting to sing about rain. said:
This isn't portable. And it's just "not" how to do it.
It is portable to systems that have sockets, which is a lot.
It is not maximally portable, and you can easily write
completely standard C for it which is maximally portable.
Both are valid, but only the latter is really ontopic here.

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top