This is the mail archive of the gcc@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: gcc-in-cxx branch created


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



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