B
Brian
In the past there's been discussion about how using memcpy
to assist marshalling integral data should be avoided due to
portability reasons. From some very limited testing themore
portable approach that uses bit shifting to output/marshall
integral data is roughly 10 to 15% slower than using memcpy.
I'm wondering if it is possible to set things up so that the
more portable functions are used in a more limited way than
what I've seen suggested here. For example if a server
has both big endian and little endian (Intel) clients, would
it work to have the server send a "big endian" stream to
the big endian clients and a "little endian" stream to
Intel clients -- then both of those types of clients could
use memcpy to read/demarshall integral data types?
I believe it is possible to use memcpy without having
alignment problems. I know it is possible to show
examples of alignment problems using memcpy, but I
don't think those are relevant to marshalling of data
structures that a compiler has set up to it's liking.
What am I missing? Something to do with compiler
flags?
Brian Wood
http://webEbenezer.net
to assist marshalling integral data should be avoided due to
portability reasons. From some very limited testing themore
portable approach that uses bit shifting to output/marshall
integral data is roughly 10 to 15% slower than using memcpy.
I'm wondering if it is possible to set things up so that the
more portable functions are used in a more limited way than
what I've seen suggested here. For example if a server
has both big endian and little endian (Intel) clients, would
it work to have the server send a "big endian" stream to
the big endian clients and a "little endian" stream to
Intel clients -- then both of those types of clients could
use memcpy to read/demarshall integral data types?
I believe it is possible to use memcpy without having
alignment problems. I know it is possible to show
examples of alignment problems using memcpy, but I
don't think those are relevant to marshalling of data
structures that a compiler has set up to it's liking.
What am I missing? Something to do with compiler
flags?
Brian Wood
http://webEbenezer.net