Archived

This topic is now archived and is closed to further replies.

IFooBar

what happens when a var reaches its end?

Recommended Posts

hello i was wondering if say u had a DWORD, and it uses up all 32 bits of its memory space. and u keep on doing DWORD++; does it reset to 0? or will u get an access violation? thanks


Al **MY HQ**

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I believe it resets. But you can always test it:

DWORD d = 0xFFFFFFFF;
d++;

Share this post


Link to post
Share on other sites
It will reset to 0 (or for signed integers it will roll over the lowest value, like 32767+1=-32768). If you've configured your compiler to check (though I think VB is the only to do it by default, some don't even have to option) it can read the flag register to see if the last operation caused an overflow, and then issue an exception.

[edited by - michalson on August 16, 2002 9:50:24 AM]

Share this post


Link to post
Share on other sites