Re: why this program is not crashing
Jens.Toerring_at_physik.fu-berlin.de
Date: 02/11/05
- Next message: Bjørn Augestad: "Re: double to int conversion yields strange results"
- Previous message: Richard Bos: "Re: What is a sequence point?"
- In reply to: manoj1978_at_gmail.com: "Re: why this program is not crashing"
- Next in thread: Richard Bos: "Re: why this program is not crashing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 11 Feb 2005 12:41:56 GMT
manoj1978@gmail.com wrote:
> Richard Bos wrote:
>> manoj1978@gmail.com wrote:
>>
>> > buf1,buf2 and buf3 are stored in stack,
>>
>> Possibly, but even if so...
>>
>> > so incrementing pointer to buf2 goes towards buf1 not buf3.
>>
>> ...there's no reason to assume that this is true in the general case.
> It
>> may be true for you, but that doesn't automatically make it true for
> the
>> OP or anyone else. Not all the world is a Microsoft boxlet.
>>
> If they are stored in stack,then the direction will be this.right? I am
> not talking about the distance.
No. Already your first assumption that things are stored on a stack
is not necessary true - variables could also be in registers only or
there might be even machines not having a simple, linear stack. More-
over, things might not only depend on the direction the stack on your
machine grows (there are two alternatives, and both are used on diff-
erent architctures), but the compiler is in no way obliged to store
variables in a sequence resembling the the sequence the variables are
defined in the C code. It may, for example, recognize that, due to
alignment reasons, it would have to leave holes between the variables
and thus reorder them to avoid that as far as possible. So making any
assuptions about the relative positions of variables is plain wrong.
It may work in a certain way on your machine when you compile with a
certain set of options, but already changing the compiler options could
change things dramatically.
Regards, Jens
-- \ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de \__________________________ http://www.toerring.de
- Next message: Bjørn Augestad: "Re: double to int conversion yields strange results"
- Previous message: Richard Bos: "Re: What is a sequence point?"
- In reply to: manoj1978_at_gmail.com: "Re: why this program is not crashing"
- Next in thread: Richard Bos: "Re: why this program is not crashing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|