By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,557 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,557 IT Pros & Developers. It's quick & easy.

SIGNED does not allow negative values???

P: n/a
Hi!

I'm developing for many years, by i have never encountered such problem in
VC++!
I tried doing the simplest test:
Create new solution -Win32 project...

In the main procedure I wrote this:
int i=-1;

And breakpoint on the next line.

The value of i is 0xffffff !!!

I tried writing singed int, the same thing happens..
Tried all of the data types, nada.

Can anyone explain this???
Apr 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I'm developing for many years, by i have never encountered such problem in
VC++!
I tried doing the simplest test:
Create new solution -Win32 project...

In the main procedure I wrote this:
int i=-1;

And breakpoint on the next line.

The value of i is 0xffffff !!!

I tried writing singed int, the same thing happens..
Tried all of the data types, nada.

Can anyone explain this???
Yes.
You display debug information in HEX. The hex for -1 is 0xFFFFFFFF in 2's
complement.
Turn of HEX display for your debug information (e.g. from within the watch
window) and you should be fine.

Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
Apr 19 '07 #2

P: n/a
You misunderstood...
I wrote 0xffffff so it is more readable than 16777215...
I already checked the values in decimal view...

The problem appears to be something with too loaded memory :-D
After a restart, everything went back to normal...

Thanks anyway!

"Bruno van Dooren" wrote:
I'm developing for many years, by i have never encountered such problem in
VC++!
I tried doing the simplest test:
Create new solution -Win32 project...

In the main procedure I wrote this:
int i=-1;

And breakpoint on the next line.

The value of i is 0xffffff !!!

I tried writing singed int, the same thing happens..
Tried all of the data types, nada.

Can anyone explain this???

Yes.
You display debug information in HEX. The hex for -1 is 0xFFFFFFFF in 2's
complement.
Turn of HEX display for your debug information (e.g. from within the watch
window) and you should be fine.

Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
Apr 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.