Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Variable on stack or heap?

You cannot.

int x = 0;
int* py = new int;

int* pInt = &x;
pInt = py;

Am 06.11.2009 um 16:42 schrieb Gavin Rehkemper:

We have a variable, and we know it is a pointer. How do we determine whether it points to something allocated on the heap (malloc'd, for example), or something allocated on the stack (an array of finite length).

Thanks for the help!
Gavin
On Fri, Nov 6, 2009 at 6:51 AM, <cdt-dev-request@xxxxxxxxxxx> wrote:
Date: Thu, 5 Nov 2009 20:09:28 -0500
From: Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx>
Subject: Re: [cdt-dev] Variable on stack or heap?
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Message-ID:
       <5498d4500911051709k290c4e5eocaf19a8f50c155ce@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1
Never herd of syntax to declare variable in C in the heap. What do you mean? On Thu, Nov 5, 2009 at 7:18 PM, Gavin Rehkemper <gavreh@xxxxxxxxx> wrote:
> Hi everyone,
>
> We are inspecting the AST in CDT. Is there any way to figure out if a > particular variable was declared on the stack or on the heap? Any help on
> this topic would be appreciated.
>
> Thanks,
> Gavin
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Ableton AG, Sitz Berlin, Amtsgericht Berlin-Charlottenburg, HRB 72838
Vorstand: Gerhard Behles, Jan Bohl, Bernd Roggendorf
Vorsitzender des Aufsichtsrats: Uwe Struck






Back to the top