Re: Variable length arrays in debugger
Re: Variable length arrays in debugger
- Subject: Re: Variable length arrays in debugger
- From: Jim Ingham <email@hidden>
- Date: Wed, 1 Oct 2008 12:12:33 -0700
Well, that example's undefined. I meant to do:
int size = input;
first. But you see what I mean...
Jim
On Oct 1, 2008, at 11:41 AM, Jim Ingham wrote:
gcc doesn't emit any debug information that tells the size of
variable length arrays. If you think about it a bit, it would be
kind of hard to express, for instance you could do:
void
foo (int input)
{
int size
int array[size];
size += input;
// Now how do I figure out what the size of "array" is?
}
gcc would somehow have to express what range of code the variable
"size" actually still contained the size used for the array. Start
sketching more devious examples and you'll realize that's pretty
hard to do in general.
I already filed a bug with the compiler to express this somehow, but
given how tricky it would be to do they haven't done anything about
it. Feel free to file a bug - it's another vote to work on this...
Anyway, without any debug info there's not much the debugger can do
to present this array.
Jim
On Oct 1, 2008, at 11:25 AM, Sean McBride wrote:
On 10/1/08 11:16 AM, Howard Moon said:
I've noticed that debugger in Xcode 3.1.1 always shows variable
length arrays as "out of scope". If I change it to constant size
array it works as it supposed to.
I'm talking about this kind of things:
int size;
....
int array[size];
I'm ready to file a bug, but would like to figure before if I'm not
alone in this or may be there is some option needs to be enabled in
compiler (couldn't find anything though).
Is that an extension allowed in GCC? According to the C++ Standard,
arrays must have a compile-time constant size. Perhaps the Xcode
debugger assumes that rule to be the case, even if the compiler has
allowed it to compile?
It is part of C99. Maybe also in C++0x ?
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden