|
From: Adam G. <ar...@cy...> - 2004-10-18 15:05:16
|
At 03:47 PM 10/18/2004 +0100, Nicholas Nethercote wrote: >On Mon, 18 Oct 2004, Adam Gundy wrote: > >>you are assuming that sizeof( int ) == sizeof( char * ), which it won't on >>64 bit platforms... just a thought. > >Hmm, yes. I'll fix. Thanks. > >>what's wrong with: >> >>init_sp = &argc; > >Is it actually certain that argc will be on the stack? Eg. for PPC, functions args usually get passed in registers... I'm not really sure, I'm copying Paul Mackerras' PPC port here. if it's not on the stack, then what is 'argv - 1' pointing to? some random piece of data above it on the stack... I would guess that if argc is a register, and you ask for &argc, the compiler will generate a temporary on the stack which you can mess with (but it wouldn't be what you want.. it would be somewhere in the local variables) could be wrong though... try writing a five line program on PPC and seeing what assembler you get (I know that's not portable) you know that GCC has some builtins that return things like this? http://ou800doc.caldera.com/cgi-bin/info2html?(gcc.info)Return%2520Address&lang=en Seeya, Adam -- Real Programmers don't comment their code. If it was hard to write, it should be hard to read, and even harder to modify. These are all my own opinions. |