-
August 21st, 2022, 01:02 AM
#1
DWORD size in VS
in visual studio when moving mouse over a DWORD variable, it shows 5 bytes. I expected to see 4 bytes. Not sure why i see extra byte there?. sizeof(DWORD) shows 4 bytes. this happens in x64 , do not remember if looked at it in 32 bit mode as well?.
-
August 21st, 2022, 04:07 AM
#2
Re: DWORD size in VS
Originally Posted by @EE@
a DWORD variable, it shows 5 bytes
Maybe the variable is a DWORD array. In that case, the 5 you see could denote the array size (rather than the DWORD size.)
-
August 21st, 2022, 05:56 AM
#3
Re: DWORD size in VS
Originally Posted by @EE@
in visual studio when moving mouse over a DWORD variable, it shows 5 bytes. I expected to see 4 bytes. Not sure why i see extra byte there?. sizeof(DWORD) shows 4 bytes. this happens in x64 , do not remember if looked at it in 32 bit mode as well?.
Where do you see the DWOORD size?
Attachment 36057
Attachment 36058
I don't see any size info here. VS 2022 17.2.6. It is shown the same info for both x86 and x64
Victor Nijegorodov
-
August 21st, 2022, 06:15 AM
#4
Re: DWORD size in VS
DWORD is unsigned 32-bit - irrespective of 32/64 bit. When you hover the mouse over a DWORD type, intellisense shows a typedef (as per Victor's 36058 above).
If you're seeing a number when hovering over a variable, then that is an array and you're seeing the array size.
Post your code so that we can see what's going on.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 21st, 2022, 10:19 AM
#5
Re: DWORD size in VS
DWORD dw;
dw = CalcAvgOfArray(...)
when I move mouse over the dw in debug mode i see dw like 3465238465. this is 5 bytes not 4 bytes.
cout << sizeof(DWORD); shows 4.
can't open Victor's attachments.
Last edited by @EE@; August 21st, 2022 at 09:31 PM.
-
August 21st, 2022, 11:14 AM
#6
Re: DWORD size in VS
3465238465 is 0xCE8B57C1 which is 4 bytes - 32 bits!
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 21st, 2022, 09:32 PM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|