Re: sizeof problem in kernel modules

Andreas Schwab (schwab@suse.de)
25 Jun 2001 17:07:09 +0200


Alan Shutko <ats@acm.org> writes:

|> Alan Shutko <ats@acm.org> writes:
|>
|> > You can look at other things too... you can memcpy structures, pass
|> > them into functions, call sizeof, put them in arrays... it _is_ a
|> > physical representation.
|>
|> One more tidbit: ISO/IEC 9899:1990 3.14
|>
|> 3.14 object: A region of data storage in the execution environment,
|> the contents of which can represent values. Except for
|> bit-fields, objects are composed of contiguous sequences of one or
|> more bytes, the number, order and encoding of which are either
|> explicitely specified or implementation-defined.
|>
|> This would specifically prohibit separating any part of a structure
|> from the rest.

But only under the as-if rule, that is, if you never take the address of a
structure object the compiler can actually put the parts of it anywhere it
likes, because you couldn't notice the difference.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/