gcc-in-cxx branch created
Ross Smith
r-smith@ihug.co.nz
Wed Jun 25 05:49:00 GMT 2008
Ian Lance Taylor wrote:
>
> I expect that we will find it appropriate to use STL containers, as in
> for (Type::iterator p = container.begin(); p != container.end(); ++p)
For loops like this I'd recommend using some kind of FOREACH macro (the
functional equivalent of BOOST_FOREACH; this is easy to write when you
can use GCC's typeof feature). I've found that using a FOREACH macro
improves code readability significantly. Not only is the normal case
shorter and clearer, but it also means that when you do spell out a for
loop explicitly, it acts as a signal to the reader that "we're doing
something more complicated than straightforward iteration here, so read
carefully".
-- Ross Smith
More information about the Gcc
mailing list