On Fri, 31 Oct 2003 06:20:27 GMT
Don't delete the attributions for parts of the message you are replying
to. It makes it harder to follow the thread.
I'm going to ignore this. Go to the other thread to talk about this.
In which case you will not get any help with C from a lot of the more
knowledgeable people on this group should you want any.
Some variables are stored on the stack, with "auto" storage. This is
in contrast to those that are statically or dynamically allocated. If
you can't understand this, then I doubt you actually code in the real
world and work successfully with others.
Ever heard of registers? A
*lot* of good compilers will store automatic variables in registers
where possible rather than on the stack.
Let me guess. You also boil with rage over HTML e-mail, Microsoft
software,
I have a strong dislike of HTML for many reasons. I also dislike a lot
of MS software for usability reasons.
and people who don't format code like yourself.
I only object to people not following project or company formatting
standards since it can make reading the code harder.
I wonder
how any of you get things done -- oh wait, you don't. You're probably
underemployed -- sadly with some decent skills/knowledge -- and sit at
home fiddling with your operating system all day, while people without
such brittle personalities build interesting things that people use.
Now you are just insulting someone simply because they disagree with
you. I suspect that Jack Klein does have a job.
BTW, I'm only replying to ensure that anyone else reading this thread
will see that you are spouting rubbish.
I'll grant you that. But I don't care, because I care about getting
things done, and answering questions. Not trivial technicalities.
Show me a compiler and platform with a stack where this technique does
not work. Then we'll talk.
To give you a specific and common example, gcc version 3.3.2 when used
with the -O3 option. I did this and the compiler produced assembler code
that did not use a local variable in main at all, instead it called fn
then pushed 20 on to the stack. Therefor your suggestion would not have
worked.
My experience with compilers is that many of them will do this type of
optimisation. My experience with various operating systems and hardware
is that in at least some instances an attempt to smash the stack to
modify the actual code (the only way you could do it if decent
optimisation is performed by the compiler) is that it is not always
possible to modify the code since it may be in memory that the running
executable does not have write access to. Given such a common
optimisation and write protected code it is not possible for the code to
change what the printf in main will print on some systems, only to
prevent it from reaching the printf.
And why don't you be constructive, and show me another way to answer
the original poster's question.
Possibly he felt that it had been answered correctly. Certainly his
pointing out how wrong you are could be considered as helping the OP.