On Fri, 2012-12-07 at 08:17 -0500, Hiram Chirino wrote: > Wouldn't it be cleaner to implement those functions as macros for the > platforms that don't define it?
I think this is a misunderstanding - The platform in question is *ANSI C* and this does not define any network to host byte order conversion functionality. ntohl() etc. are defined by the Sockets API. The proton engine code is intended to be as absolutely portable as possible and not depend on anything beyond ANSI C. This will allow it to be used anywhere that ANSI C is available[1]. Additionally as I note in the review comments the use of the byteswapping APIs is problematic as it can cause unintended unaligned memory accesses - even on the i386 architecture where this is allowed it is slower, on other architectures, I think for example ARM, it will cause a bus error. Andrew [1] I know that it's turned out that using ANSI C99 has not turned out as portable as we originally thought, but who'd have thought that Microsoft would ignore a C standard for over 10 years. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
