From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4deb6c62a5e19f2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-31 00:06:05 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-kar1.dfn.de!news-han1.dfn.de!news.fh-hannover.de!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: type Foo_ptr in new void*; Date: Tue, 31 Jul 2001 09:22:07 +0200 Organization: Enyo's not your organization Message-ID: <874rrtzhpc.fsf@deneb.enyo.de> References: <9k03jc$2me$2@news.tpi.pl> <9k0j60$n4t$1@news.tpi.pl> <3B63F48A.2E2642C6@earthlink.net> <9k2btj$5hj$1@news.tpi.pl> <3B64C26F.C195B4E0@worldnet.att.net> <9k517e$rbh$5@news.tpi.pl> <3B662129.D6055BAA@worldnet.att.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: archiver1.google.com comp.lang.ada:10830 Date: 2001-07-31T09:22:07+02:00 List-Id: James Rogers writes: >> It's illegal to do pointer arith on void* or incomplete types. > > It is illegal, but not necessarily caught by the compiler. C compilers must issue diagnostics if the source code contains pointer arithmetic on an incomplete type. > This means that the correct answer is not compilation error. It is, read the standard: there is a constraint that pointer arithmetic shall be done only on pointers to object types (which excludes function pointers and pointers to incomplete types), and constraint violations must be detected by the compiler. > C compilers are actually pretty primitive in their understanding of > data type completion. It's not that primitive. > They rely on highly intelligent linkers to find all the completions. The C object model certainly does not require any linker support for incomplete types. In fact, types never appear in linker input. (Of course, there are obscure targets for which these things are not true, e.g. the x86 target with a segmented memory model, but it's quite hard for compilers for such targets to conform to the C standard anyway).