home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.std.c
- Subject: Re: Struct hack one last time (one last time)
- Message-ID: <1993Jan8.135644.18732@crd.ge.com>
- Date: 8 Jan 93 13:56:44 GMT
- References: <1993Jan7.221207.13818@leland.Stanford.EDU>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 27
- Nntp-Posting-Host: bart.crd.ge.com
-
- In article <1993Jan7.221207.13818@leland.Stanford.EDU>, dkeisen@leland.Stanford.EDU (Dave Eisen) writes:
- |>
- |> This has nothing to do with malloc. The hypothetical compiler
- |> could simply insert this error checking information whenever
- |> it does a conversion from a (void *) to a (struct foo *). Again,
- |> the basic question is still unresolved here: can a conversion
- |> from one pointer type to another affect bytes other than those
- |> where the pointer variable is stored?
-
- Of course not. What would happen in the following program?
-
- int main(void)
- {
- struct foo {double field[2];} *fp;
- char bar[]="LongerThanSizeOfStructFoo";
- fp = (struct foo *)bar;
- /* Does the above cast modify the contents of bar? */
- if (strcmp(bar,"LongerThanSizeOfStructFoo"))
- fprintf(stderr,"Dumb-ass compiler\n");
- return 0;
- }
-
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-