Sticking a Hand Through Time: Adventures on the call stack
web.engr.illinois.edu
web.engr.illinois.edu
(And I used to be a gcc maintainer for m68k and i860. I'm quite familiar with frame pointers and their non-use.)
Btw: you can do this trick without resorting to assembly - start by taking the address of a local variable.
The Common Lisp condition system (http://www.gigamonkeys.com/book/beyond-exception-handling-co...) is worth understanding, even if you're developing in other languages. It's an elegant example of how to manipulate the call stack. Unfortunately, it's hard to implement in most other languages.
if (x == 1 || x == 2 || x == 3 || x == 4)
printf("What the fuck?");That seems to make it legal C. It also would make
switch(i) x += 1;
and possibly even switch(i) foo: x += 1;
valid (but nonsensical) C. Chances are that the standard contains special wording that prohibits the latter two, though. If not, this is useful to know for the obfuscated C contest (more so if you can jump to that label)