This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is c-iterate.c good for?
- To: Bernd Schmidt <crux at pool dot informatik dot rwth-aachen dot de>
- Subject: Re: What is c-iterate.c good for?
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 22 Jun 1998 12:01:23 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
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