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]

Re: What is c-iterate.c good for?



  In message <Pine.SOL.3.90.980622151513.5246I-100000@clouseau.informatik.rwth-en.de>you write:
  > By reading c-parse.in I managed to construct a program using iterators:
  > 
  > int main ()
  > {
  >   __iterator i = 2;
  > 
  >   for (i)
  >     printf ("Hello, world\n");
  >   return 0;
  > }
  > 
  > This prints "Hello, world" twice. Now, my question is: what is this good fo  > r?
It describes at a slightly higher level than C that you want to iterate
on a series of objects performing some action.

  > It's a GCC extension, but it isn't documented
Right.

  > and I don't really see the point of it. 
I've heard rumors that something like this might end up in c9x.  It's
also been postulated that we could use iterators to describe situations
where mmx style instructions could be used.

  > Does anyone use it? Is the above all that can be done with it?
I don't believe there's anything you can do with an iterator that
can't be done with some other loop construct.  However, an iterator
may allow us to describe what's going on to the compiler at a higher
level.

  > If there is no good reason to have it, maybe it should go the way of the
  > bytecode stuff?
In our last company meeting, several of the gcc folks actually suggested
the same thing, but we tabled the idea because of the possibility of
using iterators to provide support for generating mmx instructions.

The iterator scheme certainly needs some documentation is it is going
to stay in the compiler though.

jeff


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