Article View: comp.std.c
Article #2139Re: struct hack
From: David Adrien Tanguay
Date: Fri, 16 Oct 1992 18:03
Date: Fri, 16 Oct 1992 18:03
22 lines
1198 bytes
1198 bytes
msb@sq.sq.com (Mark Brader) writes:
>There is no difference. The standard says (in 3.1.2.5 = 6.1.2.5) that
>a pointer provides a reference to the pointed-to type. It does not say
>that it carries any additional information. We agree that p and the
>decayed f->s point to the same char. This char is in the array f->s,
>and also, *simultaneously*, in the array returned by malloc.
Will the following also work?
struct blah { int i; char s[1]; };
union {
char xxx[10*sizeof(struct blah)];
struct blah f;
} u;
u.f.s[1] = 'x';
Or?
struct blah farr[10];
farr[0].s[1] = 'x';
--
David Tanguay dat@Thinkage.on.ca dat@Thinkage.com uunet!thinkage!dat
Thinkage, Ltd. Kitchener, Ontario, Canada [43.40N 80.47W]
Technical Details
Message-ID:
<1992Oct16.180320.26882@thinkage.on.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!utcsri!torn!watserv2.uwaterloo.ca!watmath!thinkage!datReferences:
<1992Oct8.174101.19668@sq.sq.com> <KANZE.92Oct10152357@slsvdnt.us-es.sel.de> <1992Oct14.070847.20455@sq.sq.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!torn!watserv2.uwaterloo.ca!watmath!thinkage!dat From: dat@thinkage.on.ca (David Adrien Tanguay) Subject: Re: struct hack Message-ID: <1992Oct16.180320.26882@thinkage.on.ca> Organization: Thinkage, Ltd. References: <1992Oct8.174101.19668@sq.sq.com> <KANZE.92Oct10152357@slsvdnt.us-es.sel.de> <1992Oct14.070847.20455@sq.sq.com> Date: Fri, 16 Oct 1992 18:03:20 GMT Lines: 22