On Tue, Oct 10, 2023 at 12:30:52PM -0400, Jason Merrill via Gcc wrote:
> On Tue, Oct 10, 2023 at 7:30 AM Florian Weimer via Gcc <gcc@gcc.gnu.org>
> wrote:
> 
> > Are these code fragments valid C89 code?
> >
> >   int i1 = 1;
> >   char *p1 = i;
> >
> >   char c;
> >   char *p2 = &c;
> >   int i2 = p2;
> >
> > Or can we generate errors for them even with -std=gnu89?
> >
> > (It will still be possible to override this with -fpermissive or
> > -Wno-int-conversion.)
> >
> 
> Given that C89 code is unlikely to be actively maintained, I think we
> should be permissive by default in that mode.  People compiling with an old
> -std flag are presumably doing it to keep old code compiling, and it seems
> appropriate to respect that.

Yeah, complete agreement here.

> I'm also (though less strongly) inclined to be permissive in C99 mode, and
> only introduce the new strictness by default for C11/C17 modes.

Especially when the default is -std=gnu17 that can be an option as well.

There might be some code in the wild compiled with -std=gnu99 or -std=c99 just
because it wanted to use C99 features back 15-20 years ago and hasn't been
adjusted since then, but it might be better to adjust that if needed and keep
using those flags only when they are needed because the code isn't C11/C17/C2X
ready.

        Jakub

Reply via email to