C++ PATCH: 14035

Kai Henningsen kaih@khms.westfalen.de
Wed Oct 20 23:02:00 GMT 2004


mark@codesourcery.com (Mark Mitchell)  wrote on 20.10.04 in <4176AB4F.8040208@codesourcery.com>:

> Gabriel Dos Reis wrote:
>
> >Nathan Sidwell <nathan@codesourcery.com> writes:
> >
> >| Mark Mitchell wrote:
> >|
> >| > On the other hand, I don't feel very strongly about that point of
> >| > view; if you and Jason think we should not issue a diagnostic, even
> >| > with -pedantic, that's OK with me.  Perhaps we could change the
> >| > pedwarn into a warning?  That would mean that it would not be an
> >| > error by default.  (The fact that pedwarns are errors by default
> >| > seems confused to me anyhow, but that's something where Jason and I
> >| > can't seem to persuade each other.)
> >|
> >| A warning would be fine in pedantic mode.
> >
> >I don't think -pedantic should be required.
> >
> >
> I do think it should be required.
>
> There's no point in warning by default about a technical violation of
> the standard for code that works on virtually all systems.  And I only
> say "virtually" because I'm not sure what obscure systems exist of which
> I am unaware; I do not know of any systems on which these casts would
> actually fail.

Presumably systems unsupported by gcc.

For example, there's an x86 (x<3) memory model where code and data are  
distinct 64kB segments, and pointers are 16 bit offsets. You might be able  
to have a data pointer that points to a function if those segments  
overlap, but you won't get it unless your cast knows what constant to add  
or subtract - and the pointer might not be in the overlap region.

Or in short, any system where you can have nonoverlapping code and data  
spaces.

MfG Kai



More information about the Gcc-patches mailing list