comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: type Foo_ptr in new void*;
Date: Tue, 31 Jul 2001 09:22:07 +0200
Date: 2001-07-31T09:22:07+02:00	[thread overview]
Message-ID: <874rrtzhpc.fsf@deneb.enyo.de> (raw)
In-Reply-To: 3B662129.D6055BAA@worldnet.att.net

James Rogers <jimmaureenrogers@worldnet.att.net> 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).



  parent reply	other threads:[~2001-07-31  7:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-29  4:31 type Foo_ptr in new void*; Tomasz Wegrzanowski
2001-07-29  5:56 ` tmoran
2001-07-29  8:57   ` Tomasz Wegrzanowski
2001-07-29 12:26     ` Marc A. Criley
2001-07-30  1:05       ` Tomasz Wegrzanowski
2001-07-30  1:20         ` tmoran
2001-07-30  2:09         ` James Rogers
2001-07-30  2:36           ` Warren W. Gay VE3WWG
2001-07-30  3:10             ` James Rogers
2001-07-31  2:14               ` Warren W. Gay VE3WWG
2001-07-31  1:21           ` Tomasz Wegrzanowski
2001-07-31  3:06             ` James Rogers
2001-07-31  5:02               ` Warren W. Gay VE3WWG
2001-07-31  7:22               ` Florian Weimer [this message]
2001-07-31  4:56           ` Darren New
2001-08-04  6:05             ` David Thompson
2001-08-05  2:27               ` Warren W. Gay VE3WWG
2001-07-29 13:40     ` Dale Stanbrough
2001-07-29 14:12 ` Florian Weimer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox