DMD Bug or not? foreach over struct range
Jonathan M Davis
jmdavisProg at gmx.com
Wed May 16 01:03:50 PDT 2012
On Wednesday, May 16, 2012 09:48:20 Era Scarecrow wrote:
> Hmmm...
> [quote]
> void main()
> {
> Foo foo;
> foreach(val; foo)
> writeln(foo.val, " ", val);
> }
> [/quote]
>
> Indeed... he is using foo.val isn't he? Instead he should just
> use 'val' by itself.
Well, there's nothing wrong with it as long as you know what it's doing and
that behavior is what you want. The problem is when you expect it to be doing
something else than what it is, and I suspect that what he provided was just
an example and that whatever he was doing in actual code when he ran into the
problem wasn't quite as obvious as that.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list