For wacky loop madness, it doesn't get much stranger than loop unrolling in
C/C++
So I present to you... <drum roll> ...Duff's Device!
(lifted direct from Wikipedia)
send(to, from, count)register short *to, *from;register count;{
register n=(count+7)/8;
switch(count%8){
case 0: do{ *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
}while(--n>0);
}}
Such elegance!
Such conciseness!
Why oh why did I ever allow Scala, with it's complexity and ugly, ugly
functional constructs to enter my life?
It's nothing but a virtuous life of clean, simple,
comprehensible imperative code for me from now on!
On 4 August 2010 01:09, Vince O'Sullivan <[email protected]> wrote:
> for (Strange loop : loops)
> if (loop.isStrange())
> continue;
>
> On Aug 3, 6:23 pm, Alex <[email protected]> wrote:
> > The deadline for the contest will be Aug. 31st! Give us your loops!
> >
> > Alex
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
>
--
Kevin Wright
mail/google talk: [email protected]
wave: [email protected]
skype: kev.lee.wright
twitter: @thecoda
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.