in reply to Re^2: Twirling baton progress indicator in Perl
in thread Twirling baton progress indicator in Perl
Make no mistake, I’m not complaining about C. I like the language quite a bit, and so long as I don’t have to monkey around on the heap too much it’s a lot of fun. (I also enjoy writing shell scripts and XSLT… :-))
Yes, under the covers, baton[position++ % 4] is pointer arithmetic, but abstractly it is no more pointer arithmetic than your perl usage.
Apologies for the bad wording – what I meant to express was that you are addressing particular characters in something that’s not overtly an array. Although now that I think about it, even an honest-to-goodness character array is quite simple so use, you just do something like
char[] baton = { '-', '\\', '|', '/' }; int num_batons = sizeof( baton ) / sizeof( baton[0] );
So yeah, I retract that comment. Still, I’ve seen this class of problem very frequently handled with switch in C – and as I now realize, there’s even less reason to do it that way than I thought, even in C.
Hrm.
Makeshifts last the longest.
|
|---|