Re: doubt on regarding stacks
From: Neil Kurzman (nsk_at_mail.asb.com)
Date: 02/25/05
- Next message: Neil Kurzman: "Re: doubt on regarding stacks"
- Previous message: Randy Howard: "Re: [OT] pdf version of C unleashed ?"
- In reply to: dandelion: "Re: doubt on regarding stacks"
- Next in thread: infobahn: "Re: doubt on regarding stacks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Feb 2005 04:52:48 GMT
dandelion wrote:
> "Richard Bos" <rlb@hoekstra-uitgeverij.nl> wrote in message
> news:421dbcd8.68437036@news.individual.net...
> > "pmm" <muralipmanohar@hotmail.com> wrote:
> >
> > > Is there any way to know in which direction stack grows
> >
> > Not in ISO C. In fact, ISO C does not guarantee that you even _have_ a
> > stack as you understand that term.
>
> Correct, of course, but OTOH, you would have a pretty unusual platform if
> you did not.
>
many 8bitters the PIC and 8051 for example.
>
> One filthy trick you could employ (with all warnings set abut
> non-portability and compliance) is to
> take the address of some local variable, call a function allocating another
> local and take that address,too. Then a simple comparison of the addresses
> would yield the direction in which the stack grows (assuming your compiler
> does indeed have a stack and uses it).
>
> However, that falls into the "Filthy Tricks" department and you no
> guarantees whatsoever that it will indeed work on your target platform.
>
> Usually consulting the documentation on your CPU/Compiler will yield more
> reliable answers.
- Next message: Neil Kurzman: "Re: doubt on regarding stacks"
- Previous message: Randy Howard: "Re: [OT] pdf version of C unleashed ?"
- In reply to: dandelion: "Re: doubt on regarding stacks"
- Next in thread: infobahn: "Re: doubt on regarding stacks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|