Duff's device
T. William Wells
bill at proxftl.UUCP
Thu Sep 8 00:25:41 AEST 1988
In article <32941 at cca.CCA.COM> g-rh at CCA.CCA.COM (Richard Harter) writes:
: Now all us good children know that when we write a loop with conditionals
: the compiler does some magic for us -- it creates some labels and transfers
: and tests and maybe does some block allocation. And it is incumbent upon
: us not to confuse the compiler. If I declare some variables at the start
: of the loop are they going to be there when I jump into the middle? This
: is the sort of code that you have to be a language lawyer to be sure that
: it works right -- and you have to assume that the compiler writer was a
: good language lawyer too. I don't like to write code that requires being
: a language lawyer to read and verify; life is too short.
Pardon, but the question of what happens to local variables when
entering a loop from other than the top has never been an obscure
issue in C. Both K&R and ANSI assert that the locals will *not*
be initialized, and K&R implies and ANSI explicitly states that
the memory for the locals will be allocated.
I also don't know of any compiler that fails to allocate space in
this situation. Does anyone know of any?
---
Bill
novavax!proxftl!bill
More information about the Comp.lang.c
mailing list