This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] make function_args_iterator a proper iterator


On 11/19/2018 03:48 AM, Eric Botcazou wrote:
Eventually, when GCC moves to more a recent C++ revision, it will
become possible to simplify the for loops to make use of the range
based for loop syntax along the lines of:

   for (auto argtype: function_args (functype))
     {
       ...
     }

Tested on x86_64-linux, and (lightly) on powerpc64le-linux using
a cross-compiler.  I'll test the changes to the other back ends
before committing.

How does this interact with debugging?  Because, in my experience, the more
you convert things to modernish C++, the less you can easily debug them...

There are no unexpected interactions that I'm aware of.  The C++
11 range for loop is just convenient syntax that the front end
"expands" to a conventional loop using ordinary iterators.  Calls
to the iterator members that implicitly take place can be stepped
into using the debugger just like any other functions.  In terms
of the user experience, I'd say the range for loop is pretty close
to a macro that expands to the use iterators.

Martin


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