Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #70695 > unrolled thread
| Started by | T <T@invalid.invalid> |
|---|---|
| First post | 2019-12-27 13:24 -0800 |
| Last post | 2019-12-31 10:27 -0800 |
| Articles | 20 on this page of 71 — 18 participants |
Back to article view | Back to comp.lang.c++
What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:24 -0800
Re: What is the data structure of a NULL? Ian Collins <ian-news@hotmail.com> - 2019-12-28 10:36 +1300
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:55 -0800
Re: What is the data structure of a NULL? Bo Persson <bo@bo-persson.se> - 2019-12-28 11:28 +0100
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-27 20:50 -0500
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:14 -0800
Re: What is the data structure of a NULL? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-10 20:56 -0800
Re: What is the data structure of a NULL? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 22:42 +0100
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:55 -0800
Re: What is the data structure of a NULL? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 23:10 +0100
Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-27 14:15 -0800
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 14:24 -0800
Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-27 14:41 -0800
Re: What is the data structure of a NULL? Manfred <noname@add.invalid> - 2019-12-28 20:11 +0100
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:16 -0800
Re: What is the data structure of a NULL? Manfred <noname@invalid.add> - 2019-12-29 17:52 +0100
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-29 12:21 -0800
Re: What is the data structure of a NULL? Bart <bc@freeuk.com> - 2019-12-28 01:46 +0000
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:17 -0800
Re: What is the data structure of a NULL? Bart <bc@freeuk.com> - 2019-12-29 01:42 +0000
Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 18:39 -0800
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 02:14 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 08:33 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 13:22 -0800
Re: What is the data structure of a NULL? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-12-28 16:02 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 22:37 -0600
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 22:37 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 21:12 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 04:45 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 13:31 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 21:34 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 22:48 -0800
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-29 20:20 -0500
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 21:50 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 22:46 -0800
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 10:25 +0100
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 05:20 -0600
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 17:24 +0100
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:22 -0600
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 13:57 +0100
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 07:33 -0600
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 15:45 +0100
Re: What is the data structure of a NULL? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-12-30 18:16 +0000
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-30 10:45 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:29 -0600
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-30 21:48 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 04:19 -0600
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 17:27 +0100
Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-30 03:25 -0800
Re: What is the data structure of a NULL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-31 21:54 +0000
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-30 06:03 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:01 -0600
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-30 21:42 -0500
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 06:03 -0600
Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-31 06:17 -0800
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 10:46 -0600
Re: What is the data structure of a NULL? Melzzzzz <Melzzzzz@zzzzz.com> - 2019-12-31 16:57 +0000
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 18:15 +0100
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-31 11:20 -0800
Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2020-01-01 17:01 +0100
Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 11:21 -0600
Re: What is the data structure of a NULL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-31 21:37 +0000
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 15:21 -0800
Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 17:26 +0000
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 23:30 -0500
Re: What is the data structure of a NULL? Manfred <noname@add.invalid> - 2020-01-01 18:10 +0100
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-01 12:21 -0500
Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 15:20 +0000
Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-31 11:11 -0800
Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 19:47 +0000
Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 10:27 -0800
Page 1 of 4 [1] 2 3 4 Next page →
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-27 13:24 -0800 |
| Subject | What is the data structure of a NULL? |
| Message-ID | <qu5spt$ad8$1@dont-email.me> |
Hi All, In C++, when you make a call to Windows Kernel32.dll 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? Many thanks, -T
[toc] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2019-12-28 10:36 +1300 |
| Message-ID | <h6nbqkFctnvU3@mid.individual.net> |
| In reply to | #70695 |
On 28/12/2019 10:24, T wrote: > Hi All, > > In C++, when you make a call to Windows Kernel32.dll > 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.
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-27 13:55 -0800 |
| Message-ID | <qu5uko$7lm$2@dont-email.me> |
| In reply to | #70698 |
On 2019-12-27 13:36, Ian Collins wrote: > On 28/12/2019 10:24, T wrote: >> Hi All, >> >> In C++, when you make a call to Windows Kernel32.dll >> 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." > Since Kernel32.dll uses 32 bit words as pointers, a 32 bit word will all zero's it is. Thank you!
[toc] | [prev] | [next] | [standalone]
| From | Bo Persson <bo@bo-persson.se> |
|---|---|
| Date | 2019-12-28 11:28 +0100 |
| Message-ID | <h6op24Fo1igU1@mid.individual.net> |
| In reply to | #70703 |
On 2019-12-27 at 22:55, T wrote:
> On 2019-12-27 13:36, Ian Collins wrote:
>> On 28/12/2019 10:24, T wrote:
>>> Hi All,
>>>
>>> In C++, when you make a call to Windows Kernel32.dll
>>> 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."
>>
>
> Since Kernel32.dll uses 32 bit words as pointers, a 32 bit
> word will all zero's it is. Thank you!
>
Please note that, historically, the "32" was added to indicate that it
is no longer a 16-bit Windows (like Windows 1, 2, and 3 was).
When moving from 32 to 64 bits, the names were *not* changed. :-)
So, the suffix 32 just means "not 16".
Bo Persson
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2019-12-27 20:50 -0500 |
| Message-ID | <qu6ce2$sa9$1@dont-email.me> |
| In reply to | #70698 |
On 12/27/19 4:36 PM, Ian Collins wrote: > On 28/12/2019 10:24, T wrote: >> Hi All, >> >> In C++, when you make a call to Windows Kernel32.dll >> 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." That's the definition of a "null pointer constant". The definition of a null pointer comes on the immediately following line: "If a null pointer constant is converted to a pointer type, the resulting pointer, called a _null pointer_, is guaranteed to compare unequal to a pointer to any object or function." Note that the second occurrence of the phrase "null pointer" in that sentence is in italics, an ISO convention indicating that this sentence constitutes the official definition of the italicized phrase. In this case, it's a little unclear; the first part of that sentence is not actually the definition, it's a one of several ways to obtain a null pointer (other ways include calling various standard library functions that are documented as returning null pointers under certain circumstances). It's actually the end of that sentence that defines what null pointer is: a pointer guaranteed to compare unequal to a pointer to any object or function. The C standard says nothing about how null pointers are represented. A null pointer of type T* has a size in bytes equal to sizeof(T*), a number that is implementation-defined, not standard-defined. It is commonplace for null pointers to have all bits 0, but that's not guaranteed, and there have been a fair number of real-world implementations that have used other representations. At least one popular system I've used had a segment-offset structure for addresses, and any pointer with an offset of 0 was defined by that implementation to be a null pointer, regardless of what the segment portion of the address was. Finally, note that the OP asked about NULL. NULL is the name of a macro, #defined in several standard headers, which is required to expand into a null pointer constant. There's a huge variety of other ways to write a null pointer constant, so you shouldn't confuse "NULL" with "null pointer constant". While any null pointer constant (and therefore, in particular, NULL) will be converted into a null pointer if used in a context where it will be converted to a pointer type, it's also important to understand that null pointer constants are not the same thing as null pointers.
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-28 17:14 -0800 |
| Message-ID | <qu8umf$fur$2@dont-email.me> |
| In reply to | #70714 |
On 2019-12-27 17:50, James Kuyper wrote: > On 12/27/19 4:36 PM, Ian Collins wrote: >> On 28/12/2019 10:24, T wrote: >>> Hi All, >>> >>> In C++, when you make a call to Windows Kernel32.dll >>> 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." > > That's the definition of a "null pointer constant". The definition of a > null pointer comes on the immediately following line: > > "If a null pointer constant is converted to a pointer type, the > resulting pointer, called a _null pointer_, is guaranteed to compare > unequal to a pointer to any object or function." > Note that the second occurrence of the phrase "null pointer" in that > sentence is in italics, an ISO convention indicating that this sentence > constitutes the official definition of the italicized phrase. In this > case, it's a little unclear; the first part of that sentence is not > actually the definition, it's a one of several ways to obtain a null > pointer (other ways include calling various standard library functions > that are documented as returning null pointers under certain > circumstances). It's actually the end of that sentence that defines what > null pointer is: a pointer guaranteed to compare unequal to a pointer to > any object or function. > > The C standard says nothing about how null pointers are represented. A > null pointer of type T* has a size in bytes equal to sizeof(T*), a > number that is implementation-defined, not standard-defined. It is > commonplace for null pointers to have all bits 0, but that's not > guaranteed, and there have been a fair number of real-world > implementations that have used other representations. At least one > popular system I've used had a segment-offset structure for addresses, > and any pointer with an offset of 0 was defined by that implementation > to be a null pointer, regardless of what the segment portion of the > address was. > > Finally, note that the OP asked about NULL. NULL is the name of a macro, > #defined in several standard headers, which is required to expand into a > null pointer constant. There's a huge variety of other ways to write a > null pointer constant, so you shouldn't confuse "NULL" with "null > pointer constant". While any null pointer constant (and therefore, in > particular, NULL) will be converted into a null pointer if used in a > context where it will be converted to a pointer type, it's also > important to understand that null pointer constants are not the same > thing as null pointers. > Thank you!
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2020-01-10 20:56 -0800 |
| Message-ID | <86y2ue381n.fsf@linuxsc.com> |
| In reply to | #70714 |
James Kuyper <jameskuyper@alumni.caltech.edu> writes: > On 12/27/19 4:36 PM, Ian Collins wrote: > >> On 28/12/2019 10:24, T wrote: >> >>> Hi All, >>> >>> In C++, when you make a call to Windows Kernel32.dll >>> 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." > > That's the definition of a "null pointer constant". The definition of a > null pointer comes on the immediately following line: > > "If a null pointer constant is converted to a pointer type, the > resulting pointer, called a _null pointer_, is guaranteed to compare > unequal to a pointer to any object or function." > Note that the second occurrence of the phrase "null pointer" in that > sentence is in italics, an ISO convention indicating that this sentence > constitutes the official definition of the italicized phrase. In this > case, it's a little unclear; the first part of that sentence is not > actually the definition, it's a one of several ways to obtain a null > pointer (other ways include calling various standard library functions > that are documented as returning null pointers under certain > circumstances). It's actually the end of that sentence that defines what > null pointer is: a pointer guaranteed to compare unequal to a pointer to > any object or function. The first part of the sentence is the definition. Other ways of obtaining a null pointer value therefore must have derived that value, at some point in the program's history, by converting a null pointer to some pointer type. The second part of the sentence gives a property that null pointers must satisfy, but is not the definition of null pointer. It is perfectly possible to have a pointer value that compares unequal to a pointer to any object or function, but is not a null pointer.
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2019-12-27 22:42 +0100 |
| Message-ID | <qu5trk$sdm$1@dont-email.me> |
| In reply to | #70695 |
On 27.12.2019 22:24, T wrote: > Hi All, > > In C++, when you make a call to Windows Kernel32.dll > 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
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-27 13:55 -0800 |
| Message-ID | <qu5ukd$7lm$1@dont-email.me> |
| In reply to | #70700 |
On 2019-12-27 13:42, Alf P. Steinbach wrote: > On 27.12.2019 22:24, T wrote: >> Hi All, >> >> In C++, when you make a call to Windows Kernel32.dll >> 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 Since Kernel32.dll uses 32 bit words as pointers, a 32 bit word will all zero's it is. Thank you!
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2019-12-27 23:10 +0100 |
| Message-ID | <qu5vgi$khn$1@dont-email.me> |
| In reply to | #70702 |
On 27.12.2019 22:55, T wrote: > On 2019-12-27 13:42, Alf P. Steinbach wrote: >> On 27.12.2019 22:24, T wrote: >>> Hi All, >>> >>> In C++, when you make a call to Windows Kernel32.dll >>> 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 > > 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
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2019-12-27 14:15 -0800 |
| Message-ID | <922a2f66-ab77-4073-b17c-4b256b4621a6@googlegroups.com> |
| In reply to | #70702 |
On Friday, 27 December 2019 23:55:34 UTC+2, T wrote: > On 2019-12-27 13:42, Alf P. Steinbach wrote: > > On 27.12.2019 22:24, T wrote: > >> Hi All, > >> > >> In C++, when you make a call to Windows Kernel32.dll > >> 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 > > 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.
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-27 14:24 -0800 |
| Message-ID | <qu60b6$p27$1@dont-email.me> |
| In reply to | #70706 |
On 2019-12-27 14:15, Öö Tiib wrote: > On Friday, 27 December 2019 23:55:34 UTC+2, T wrote: >> On 2019-12-27 13:42, Alf P. Steinbach wrote: >>> On 27.12.2019 22:24, T wrote: >>>> Hi All, >>>> >>>> In C++, when you make a call to Windows Kernel32.dll >>>> 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 >> >> 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. > > 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?
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2019-12-27 14:41 -0800 |
| Message-ID | <62641bef-b109-4fcd-b95b-2272f62bdfba@googlegroups.com> |
| In reply to | #70707 |
On Saturday, 28 December 2019 00:24:46 UTC+2, T wrote: > On 2019-12-27 14:15, Öö Tiib wrote: > > On Friday, 27 December 2019 23:55:34 UTC+2, T wrote: > >> On 2019-12-27 13:42, Alf P. Steinbach wrote: > >>> On 27.12.2019 22:24, T wrote: > >>>> Hi All, > >>>> > >>>> In C++, when you make a call to Windows Kernel32.dll > >>>> 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 > >> > >> 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. > > > > > > 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.
[toc] | [prev] | [next] | [standalone]
| From | Manfred <noname@add.invalid> |
|---|---|
| Date | 2019-12-28 20:11 +0100 |
| Message-ID | <qu89co$eom$1@gioia.aioe.org> |
| In reply to | #70707 |
On 12/27/2019 11:24 PM, T wrote: > On 2019-12-27 14:15, Öö Tiib wrote: >> On Friday, 27 December 2019 23:55:34 UTC+2, T wrote: >>> On 2019-12-27 13:42, Alf P. Steinbach wrote: >>>> On 27.12.2019 22:24, T wrote: >>>>> Hi All, >>>>> >>>>> In C++, when you make a call to Windows Kernel32.dll >>>>> 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 >>> >>> 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. >> >> > > 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? > If you are running 32 bit windows, then it uses only 32-bit pointers. If you are running 64 bit windows, then it depends on the calling process (as there exist 2 versions of kernel32.dll, one for 64bit processes and one for 32bit processes). If you are still using Perl, then this means the Perl interpreter, but I guess the Perl doc should give some info on how to use pointers in native calls.
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-28 17:16 -0800 |
| Message-ID | <qu8uq8$fur$3@dont-email.me> |
| In reply to | #70742 |
On 2019-12-28 11:11, Manfred wrote: > If you are still using Perl, then this means the Perl interpreter, but I > guess the Perl doc should give some info on how to use pointers in > native calls. It does. Raku's documents are really badly written at the moment. https://docs.perl6.org/language/nativecall#Basic_use_of_pointers They are a migraine to figure out.
[toc] | [prev] | [next] | [standalone]
| From | Manfred <noname@invalid.add> |
|---|---|
| Date | 2019-12-29 17:52 +0100 |
| Message-ID | <quall2$12jh$1@gioia.aioe.org> |
| In reply to | #70748 |
On 12/29/19 2:16 AM, T wrote: > On 2019-12-28 11:11, Manfred wrote: >> If you are still using Perl, then this means the Perl interpreter, but >> I guess the Perl doc should give some info on how to use pointers in >> native calls. > > It does. Raku's documents are really badly written at the moment. > > https://docs.perl6.org/language/nativecall#Basic_use_of_pointers I see that it says that perl6 provides a Pointer type that can hold pointers. The very last sentence says "Once again, type objects are used to represent NULL pointers." I don't know what "type objects" are in Perl (this kind of confusion between types and objects is one of the reasons why I hate scripting languages), but I guess this should mean something to someone more familiar with that language. > > They are a migraine to figure out. >
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-29 12:21 -0800 |
| Message-ID | <qub1t3$hmv$1@dont-email.me> |
| In reply to | #70775 |
On 2019-12-29 08:52, Manfred wrote: > On 12/29/19 2:16 AM, T wrote: >> On 2019-12-28 11:11, Manfred wrote: >>> If you are still using Perl, then this means the Perl interpreter, >>> but I guess the Perl doc should give some info on how to use pointers >>> in native calls. >> >> It does. Raku's documents are really badly written at the moment. >> >> https://docs.perl6.org/language/nativecall#Basic_use_of_pointers > > I see that it says that perl6 provides a Pointer type that can hold > pointers. > The very last sentence says "Once again, type objects are used to > represent NULL pointers." > I don't know what "type objects" are in Perl (this kind of confusion > between types and objects is one of the reasons why I hate scripting > languages), but I guess this should mean something to someone more > familiar with that language. Hi Manfred, The documentation is such rubbish. What I had to find out through experimentation was that Native Call creates the C NULL for you when you pass it a zero. It begs the question if you actually wanted to pass a numerical zero. If you pass it an "type object", it errors out on you (crappy documentation). And if you are expecting to get a pointer back, you won't. Native call extracts the value for you. Again, crappy documentation. Native Call also tacks on a chr(0) to a C String automatically for you too. More crappy documentation. When my programs hit over 4000 lines, I would not refer to it as a "Scripting Language". Raku a hybrid language. First it gets interpreted, then the OPCODE gets compiled. It allows you to create code TWICE as FAST as a pure compiled language, but also runs TWICE as SLOW. (I am not smart enough to program in C or C++ either.) Thank you all for the help. I FINALLY have it all figured out! -T > >> >> They are a migraine to figure out. >> >
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2019-12-28 01:46 +0000 |
| Message-ID | <3uyNF.150383$5l2.106537@fx13.am4> |
| In reply to | #70702 |
On 27/12/2019 21:55, T wrote: > On 2019-12-27 13:42, Alf P. Steinbach wrote: >> On 27.12.2019 22:24, T wrote: >>> Hi All, >>> >>> In C++, when you make a call to Windows Kernel32.dll >>> 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 > > Since Kernel32.dll uses 32 bit words as pointers, a 32 bit > word will all zero's it is. Thank you! > It will be 32 bits on Win32 and 64 bits on Win64. How those 32 or 64 bits are passed also depends on the system ABI. At what level are you coding, assembly? In a well-supported HLL and using all the myriad headers that are provided, you don't normally need to worry about that. (I do because I have to use WinAPI from home-made languages and don't use the system ABI, but most people don't.)
[toc] | [prev] | [next] | [standalone]
| From | T <T@invalid.invalid> |
|---|---|
| Date | 2019-12-28 17:17 -0800 |
| Message-ID | <qu8urp$fur$4@dont-email.me> |
| In reply to | #70713 |
On 2019-12-27 17:46, Bart wrote: > At what level are you coding, assembly? https://docs.raku.org/language/nativecall
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2019-12-29 01:42 +0000 |
| Message-ID | <swTNF.346268$o8x.152318@fx15.am4> |
| In reply to | #70749 |
On 29/12/2019 01:17, T wrote: > On 2019-12-27 17:46, Bart wrote: >> At what level are you coding, assembly? > > https://docs.raku.org/language/nativecall So, this seems to be (or was) Perl6, and it already has a foreign function interface. Then you need to investigate how such calls are done using Raku's FF interface. For example it says this: "Note that a NULL string pointer can be passed by passing the Str type object; a NULL return will also be represented by the type object." Doesn't mean much to me, but in any case it's not really to do with C or C++ (half of WinAPI was originally C but MS renamed all those C interfaces as C++ at some point.) I'm surprised there isn't a ready-made set of 'bindings' to WinAPI, rather than having to create your own (there are some 10,000 WinAPI functions plus 1000s of structs, types, macros and messages). Even if you did know that a NULL pointer was passed as an all-zeros 32- or 64-bit value or whatever, it would be unwise to go that low level; you should use whatever Raku suggests is used as a null pointer.
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.c++
csiph-web