small bitmap.c patch
Christopher R. Hertel
crh at nts.umn.edu
Mon Sep 24 08:58:51 GMT 2001
Michael Sweet wrote:
> Jeremy Allison wrote:
:
> > That's why we use packing/unpacking functions and never
> > put structures onto a wire/file.
> >
> > Writing structures like that is just bad code (IMHO:-).
>
> Then there is a lot of bad code in Linux, *BSD, etc. :)
Those are OS-level constructs with a known compiler and known target
platforms. Samba is *portable* across many platforms. There are
assumptions that we cannot make, which are not even assumptions to an OS
coder.
I have had this kind of thing bite my code, using the Irix C compiler on
an Indy in fact. I have also used systems with a 2-byte word rather than
a 4-byte word and this also causes trouble if you make assumptions.
Jeremy is quite right about this[1]. The only thing that C promises is
that casting a structure to the type of the first element of the structure
will work. That's how I get away with the type casting I do in the binary
tree and linked list code.
Chris -)-----
[1] Don't you dare quote me out of context, Jeremy! ;)
--
Christopher R. Hertel -)----- University of Minnesota
crh at nts.umn.edu Networking and Telecommunications Services
Ideals are like stars; you will not succeed in touching them
with your hands...you choose them as your guides, and following
them you will reach your destiny. --Carl Schultz
More information about the samba-technical
mailing list