Groovy hepcat cody was jivin' on Fri, 17 Oct 2003 00:23:18 +0200 in
comp.lang.c.
Re: How to extract bytes from a long?'s a cool scene! Dig it!
Eric Sosman said:
cody said:
Note the special guarantee:
[#5] With one exception, if the value of a member of a union
object is used when the most recent store to the object was
to a different member, the behavior is
implementation-defined.68) 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
The special guarantee applies only to union members
that happen to be structs, and only to structs if they
"share a common initial subsequence." The union you
exhibited contained no structs at all, and is not covered
by the special guarantee.
#include <stdio.h>
union X
{
struct { long lng} A;
struct { char byt[sizeof (long)] } B;
};
And now? Two structs with a common starting point.
Yes, but no common initial sequence. Both of these structures
contain completely different data types. They have nothing in common,
except their starting address. But that's not what the above passage
is about.
I try my best
That is correct, I'm german.
I didn't know grammar of American and British is different.
Who said they're different? Eric said there were gammatical errors,
not differences in (correct) grammar. And I think it was a
tongue-in-cheek slight at the Yanks.
Honestly, not a simple task.
Even for those of us with a good grasp on English grammar.
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?