From: "Frank Joppe" <[email protected]>
> > 2) How would you rate your code for platform-independence and portability, > > especially to platforms like Windoze? > > Interesting question, how about the difference between PC (Intel) and Apple > (Motorola)? big/low endian... you can trust a protocol-complience on one > machine, but can you trust it on another? As long as there's a layer of functions which converts numeric fields within a data stream into the machine's internal representation of numbers, and back again, big endian versus little endian shouldn't be a problem. Taking care of pointer arithmetic behaviour between platforms as well, of course. The bigger issues come up with operating system facilities, like files and sockets. For instance, in *nix, sockets are treated much like file descriptors, and are compatible with file functions such as open(), close(), read(), write(), fdopen() etc. But in windoze, there are separate socket primitives - send(), recv() etc. Also, WSAStartup() must be called before any sockets are used. Also, differences in file path syntax: Unix: /dir1/dir2/../dirn/filename, Windows: C:\dir1\dir2\..\dirn\filename.ext Also, line terminators for text files: Unix: \n, Windows: \r\n And so on.
