This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printing static const variables


> You didn't say how you compiled this, or what platform you're on.
>
> Probably the compiler optimized this variable away. If so, there's no
> way to print it.


Hello Mr. Tromey.

Thank you for your comments.

I still see the same problem if change the test function to:

Boolean TestFunction( int val )
{
	static const int doubleByteDegreeMark = 42;
	static int anotherVar = 12;
	
	
	return ( val == doubleByteDegreeMark || val == anotherVar );
}

Now, I suppose it is still possible that the compiler will have simply optimized this to:

Boolean TestFunction( int val )
{
	static int anotherVar = 12;
	
	return ( val == 42 || val == anotherVar );
}

or something.

In any case, I am using Xcode 3.1 under Mac OS X 10.5

This is the debug build with all optimizations turned off.


Under other circumstances, should 'info locals' display doubleByteDegreeMark? Should I be able to print doubleByteDegreeMark?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]