- What is the data structure of a NULL? - 8 Updates
- What is | in a sub call? - 3 Updates
Ian Collins <ian-news@hotmail.com>: Dec 28 10:36AM +1300 On 28/12/2019 10:24, T wrote: > and it wants a NULL for one or more of its parameters, > what exactly is the structure of a NULL? A 32 bit > word full of zeros? The C standard defines a null pointer as "An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant." -- Ian. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 27 10:42PM +0100 On 27.12.2019 22:24, T wrote: > and it wants a NULL for one or more of its parameters, > what exactly is the structure of a NULL? A 32 bit > word full of zeros? There have been systems where a nullpointer was not all bits 0. If current PC operating systems had supported pointers with segment selectors, that would have been the situation on PC's today. However, reasonable OSes like Windows and Linux just set up a process with one big single segment, where all the app's pointers are offsets in that segment. And then a nullpointer is really all bits 0. Nullvalues of integral type are necessarily all bits 0, because the standard requires a binary representation of integral types. In C++20 that will be further restricted to two's complement form. In contrast, and 0 as a floating point value is not necessarily all bits 0, although the common IEEE 754 representation (which in particular is used on the PC: that's where the standard originated) has that property. - Alf |
T <T@invalid.invalid>: Dec 27 01:55PM -0800 On 2019-12-27 13:42, Alf P. Steinbach wrote: > the common IEEE 754 representation (which in particular is used on the > PC: that's where the standard originated) has that property. > - Alf Since Kernel32.dll uses 32 bit words as pointers, a 32 bit word will all zero's it is. Thank you! |
T <T@invalid.invalid>: Dec 27 01:55PM -0800 On 2019-12-27 13:36, Ian Collins wrote: > The C standard defines a null pointer as > "An integer constant expression with the value 0, or such an expression > cast to type void *, is called a null pointer constant." Since Kernel32.dll uses 32 bit words as pointers, a 32 bit word will all zero's it is. Thank you! |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 27 11:10PM +0100 On 27.12.2019 22:55, T wrote: >> - Alf > Since Kernel32.dll uses 32 bit words as pointers, a 32 bit > word will all zero's it is. Thank you! In 64-bit Windows, and that's modern Windows, kernel32.dll uses 64-bit pointers. Microsoft chose to keep the "32" suffixes and prefixes to ease porting of code from 32-bit systems. - Alf |
"Öö Tiib" <ootiib@hot.ee>: Dec 27 02:15PM -0800 On Friday, 27 December 2019 23:55:34 UTC+2, T wrote: > > - Alf > Since Kernel32.dll uses 32 bit words as pointers, a 32 bit > word will all zero's it is. Thank you! Calm down. On windows kernel32.dll is name of kernel access library. That name does not say what size of pointers it handles since it is same for 32-bit and 64-bit subsystem. Kernel64.dll does not exist on windows. Several of people reading this group use windows rarely or not at all so stop posting constant lies and nonsense about it. |
T <T@invalid.invalid>: Dec 27 02:24PM -0800 On 2019-12-27 14:15, Öö Tiib wrote: > windows. > Several of people reading this group use windows rarely or not > at all so stop posting constant lies and nonsense about it. What size is it then? 32 or 64 or do you have to figure out if you are running a 32 bit or 64 bit edition of Windows first? |
"Öö Tiib" <ootiib@hot.ee>: Dec 27 02:41PM -0800 On Saturday, 28 December 2019 00:24:46 UTC+2, T wrote: > > at all so stop posting constant lies and nonsense about it. > What size is it then? 32 or 64 or do you have to figure out > if you are running a 32 bit or 64 bit edition of Windows first? It depends what kind the app is that loads that dll On this laptop the C:\Windows\System32\kernel32.dll is 706 KB it uses 64 bit pointers and the C:\Windows\SysWOW64\kernel32.dll is 614 KB and uses 32 bit pointers. Notice System32 64 bit, SysWOW64 32 bit. |
T <T@invalid.invalid>: Dec 27 01:36PM -0800 Hi All, https://stackoverflow.com/questions/1387064/how-to-get-the-error-message-from-the-error-code-returned-by-getlasterror size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); What is the | do in FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS ? Is it bitwise OR'ing the three constants? Many thanks, -T |
Ian Collins <ian-news@hotmail.com>: Dec 28 10:42AM +1300 On 28/12/2019 10:36, T wrote: > FORMAT_MESSAGE_IGNORE_INSERTS > ? > Is it bitwise OR'ing the three constants? Yes. -- Ian. |
T <T@invalid.invalid>: Dec 27 01:56PM -0800 On 2019-12-27 13:42, Ian Collins wrote: >> ? >> Is it bitwise OR'ing the three constants? > Yes. Thank you! I was channeling Bash and thought they were being pipped to each other. Chuckle! |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment