This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New ARI warning Wed May 23 01:55:03 UTC 2012


> >> * configure.ac (build_warnings): Add -Wdeclaration-after-statement.
> >> * configure: Regenerate.
> 
> Yes, ok.  Thanks; I hadn't realized there was a flag for this already :)

Thanks, checked in.

> Discussion on irc pointed out that this is still allowed:
> 
>     for (int i = 0; ...)
> 
> I think this doesn't suffer from the readability problems that
> declarations in the code generally do; and in fact usually makes the
> code cleaner, by restricting the scope of the loop variable.

Agreed.

Note that this is only going to be accepted if we compile in
C99 mode, I think.  Otherwise, you'll get a warning which is
unrelated declarations being used after statements.

    error: 'for' loop initial declarations are only allowed in C99 mode

> How about we flip the switch to C99 for 7.6?

Sounds good to me. Do we want to be exclusive, rather than inclusive?
In other words, say: The following C99 constructs are allowed, and
maintain that list, rather that allow all of C99, and then list
the features not allowed. I understand that some features are still
not implemented (or portable?).

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]