digitalmars.D.learn - What's the correct way to interface with a intptr_t?
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (6/6) Apr 06 2019 I have a C interface that uses a parameter of type intptr_t. Wondering
- Alex (4/6) Apr 06 2019 I suppose, ptrdiff_t is.
- Paul Backus (2/4) Apr 06 2019 The correct equivalent is `intptr_t` from `core.stdc.stdint`.
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (6/11) Apr 07 2019 Ha, thanks... RTFM. Will do in the future.
- bauss (2/7) Apr 07 2019 Which is just an alias for ptrdiff_t.
- Paul Backus (4/12) Apr 07 2019 Unless this is guaranteed to be the case on every platform
- bauss (6/19) Apr 07 2019 It should be guaranteed since it's just supposed to be a signed
I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent? -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Apr 06 2019
On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?I suppose, ptrdiff_t is. https://dlang.org/spec/type.html#ptrdiff_t https://dlang.org/spec/portability.html#32_to_64bit
Apr 06 2019
On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?The correct equivalent is `intptr_t` from `core.stdc.stdint`.
Apr 06 2019
On 2019-04-06 20:16:06 +0000, Paul Backus said:On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:Ha, thanks... RTFM. Will do in the future. -- Robert M. Münch http://www.saphirion.com smarter | better | fasterI have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?The correct equivalent is `intptr_t` from `core.stdc.stdint`.
Apr 07 2019
On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote:On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:Which is just an alias for ptrdiff_t.I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?The correct equivalent is `intptr_t` from `core.stdc.stdint`.
Apr 07 2019
On Sunday, 7 April 2019 at 12:19:10 UTC, bauss wrote:On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote:Unless this is guaranteed to be the case on every platform druntime is ever ported to, it is technically better to use the `intptr_t` alias.On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:Which is just an alias for ptrdiff_t.I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?The correct equivalent is `intptr_t` from `core.stdc.stdint`.
Apr 07 2019
On Sunday, 7 April 2019 at 13:45:15 UTC, Paul Backus wrote:On Sunday, 7 April 2019 at 12:19:10 UTC, bauss wrote:It should be guaranteed since it's just supposed to be a signed integer of either 32 bit or 64 bit depending on the architecture you're on. D isn't supported below 32 bit systems so it's irrelevant there and thus it can be a guarantee.On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote:Unless this is guaranteed to be the case on every platform druntime is ever ported to, it is technically better to use the `intptr_t` alias.On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:Which is just an alias for ptrdiff_t.I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent?The correct equivalent is `intptr_t` from `core.stdc.stdint`.
Apr 07 2019