Re:Xcode 4 ships a buggy compiler
by FooBarWidget on Saturday December 31, 2011 @04:41AM
(#3410565)
alloca(0) is used as a way to get the end of the stack. There's a bunch of fallback #ifdefs in the code: on platforms that don't have alloca, it detects the end of the stack by calling a forced-non-inline function which returns the address of its sole local variable, but that assumes that the compiler supports the 'noinline' keyword. In any case, all of versions depend on highly platform-specific behavior. See:
https://github.com/FooBarWidget/rubyenterpriseedition187-330...
https://github.com/FooBarWidget/rubyenterpriseedition187-330...
He isn't claiming it is the only way, he is claiming it is the best way he knows of to do what he needs/thinks he needs.
I guess he wants the cleanest way to obtain the stack pointer. alloca(1) would work, too, but that runs the risk of producing a stack overflow.
Why does scanning the stack for pointers need to involve alloca(0)?