> [...], using the C standard guaranteed property that the address of > the first member is the address of the structure, allowing to cast > pointers in order to operate whether on the base structure or on the > derived structure?
Which standard promises this, and what exactly does it promise? I've been looking through C99 and the closest I've found so far is 6.5.2.3 #5, which is not quite the same: 6.5.2.3 Structure and union members ... [#5] One special guarantee is made in order to simplify the use of unions: if a union contains several structures that share a common initial sequence (see below), and if the union object currently contains one of these structures, it is permitted to inspect the common initial part of any of them anywhere that a declaration of the completed type of the union is visible. Two structures share a common initial sequence if corresponding members have compatible types (and, for bit-fields, the same widths) for a sequence of one or more initial members. Also, "address" as a technical term in C99 is very fuzzy, to the point where I doubt that the statement that "the address of the first member is the address of the structure" has a defined meaning. (It certainly will for many implementations, but that is not the same thing.) Have more recent standards turned it into something more specific? I really need to chase down a copy of something more recent and turn it into a useful form...I've got pointers, but need to follow them. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B