Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: void type Pin
Richard MacCutchan10-Apr-20 23:18
mveRichard MacCutchan10-Apr-20 23:18 
GeneralRe: void type Pin
kalberts11-Apr-20 1:22
kalberts11-Apr-20 1:22 
GeneralRe: void type Pin
Calin Negru11-Apr-20 10:25
Calin Negru11-Apr-20 10:25 
GeneralRe: void type Pin
kalberts11-Apr-20 11:36
kalberts11-Apr-20 11:36 
GeneralRe: void type Pin
Richard MacCutchan11-Apr-20 23:40
mveRichard MacCutchan11-Apr-20 23:40 
GeneralRe: void type Pin
kalberts11-Apr-20 12:01
kalberts11-Apr-20 12:01 
GeneralRe: void type Pin
Greg Utas12-Apr-20 0:20
professionalGreg Utas12-Apr-20 0:20 
GeneralRe: void type Pin
leon de boer11-Apr-20 21:51
leon de boer11-Apr-20 21:51 
It is a historic fact, now days on C99, C11 and beyond you might more correctly use a uintptr_t.

All you want really is the address but how big is that address it could be 16bits on a small micro controller, 32 bit on large CPU or 64bits on 64bit cpu. A void* pointer was usually big enough to ensure it had enough bits to point to any valid address on the CPU. So the size of a void* is completely compiler dependent. Back in the day there were also other features a void* could be cast to and from any other pointer without warning. The reason is obvious you want to be able to copy the address to a pointer of type and use normal c pointer functions.

Now move forward and look at a uintptr_t this is the C99 definition in stdint.h for portability under XSI-conformant systems
Quote:
"an unsigned integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer".

It acts like a void* pointer with one safety added the conversion to and back is guaranteed, which never was with void* and occasionally cropped up and you can safely do it on any pointer type.

It also means when you look at it in a debugger it shows as an unsigned integer rather than a pointer which is more in keeping with what it really is ... an address to somewhere in CPU memory space.
In vino veritas

GeneralRe: void type Pin
Calin Negru11-Apr-20 21:47
Calin Negru11-Apr-20 21:47 
QuestionHow do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 5:57
PotatoSoup6-Apr-20 5:57 
AnswerRe: How do I add listboxes to a back buffer and use that? Pin
Richard MacCutchan6-Apr-20 6:21
mveRichard MacCutchan6-Apr-20 6:21 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 6:46
PotatoSoup6-Apr-20 6:46 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
Richard MacCutchan6-Apr-20 7:04
mveRichard MacCutchan6-Apr-20 7:04 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 7:26
PotatoSoup6-Apr-20 7:26 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
Victor Nijegorodov6-Apr-20 8:24
Victor Nijegorodov6-Apr-20 8:24 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 8:43
PotatoSoup6-Apr-20 8:43 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
Victor Nijegorodov6-Apr-20 8:49
Victor Nijegorodov6-Apr-20 8:49 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 11:07
PotatoSoup6-Apr-20 11:07 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
leon de boer6-Apr-20 21:06
leon de boer6-Apr-20 21:06 
SuggestionRe: How do I add listboxes to a back buffer and use that? Pin
David Crow6-Apr-20 8:59
David Crow6-Apr-20 8:59 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 11:31
PotatoSoup6-Apr-20 11:31 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
Greg Utas6-Apr-20 12:39
professionalGreg Utas6-Apr-20 12:39 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 12:52
PotatoSoup6-Apr-20 12:52 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
Greg Utas6-Apr-20 12:55
professionalGreg Utas6-Apr-20 12:55 
GeneralRe: How do I add listboxes to a back buffer and use that? Pin
PotatoSoup6-Apr-20 18:58
PotatoSoup6-Apr-20 18:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.