9fans archive / 2002 / 11 / 473 prev next
From: Clint Olsen <clint@0ls...>
Subject: how to avoid a memset() optimization
Date: Fri, 22 Nov 2002 09:59:57 GMT
In article <Pine.LNX.4.44.0211130911030.27108-100000@car...>,
Ronald G. Minnich wrote:
>
> struct x {
> int a;
> int b;
> };
>
> resulting in code in which a and b are laid out in memory in the same
> order as in the structure (this due to C++). Structure members can get
> reordered.
This would violate the C standard that a pointer to a struct is compatible
with a pointer to its first argument. That be busted...
-Clint