Re: Strangest language feature
by huhtenberg on Sunday March 24, 2013 @05:02PM
(#5433575)
For C it should most certainly be the ability to interleave the switch-case and a block statement as per Duff's device:
[0] http://en.wikipedia.org/wiki/Duff%27s_device
[ Parent
| on HN ]
I wouldn't necessarily call this strange if you think about how this directly translates to assembly instructions.
It's pretty strange nonetheless that it compiles at all. Underlying it is that a switch statement isn't a proper control structure but syntax sugar for goto.
while() loops are really syntax sugar for goto too. And whole C is arguably just a syntax sugar for assembler :) That's why we use it.