Jump to page: 1 2 3
Thread overview
From the D Blog -- Interfacing D with C: Strings Part One
May 24, 2021
Mike Parker
May 24, 2021
zjh
May 24, 2021
zjh
May 24, 2021
Mike Parker
May 24, 2021
zjh
May 24, 2021
zjh
May 24, 2021
rikki cattermole
May 24, 2021
zjh
May 24, 2021
rikki cattermole
May 25, 2021
zjh
May 25, 2021
Vinod K Chandran
May 25, 2021
zjh
May 26, 2021
dangbinghoo
May 26, 2021
zjh
May 24, 2021
sighoya
May 24, 2021
Mike Parker
May 24, 2021
John Colvin
May 25, 2021
Mike Parker
May 25, 2021
surlymoor
May 25, 2021
Mike Parker
May 26, 2021
Ali Çehreli
May 24, 2021

The latest post in the D and C series dives into the weeds of D and C strings: how they're implemented, when you need to NUL-terminate your D strings and when you don't, and how the storage of literals in memory allows you to avoid NUL termination in one case you might not have considered and another case that you shouldn't rely on but can in practice with the current compilers.

There are at least two more posts worth of information to go into on this topic, but everything in this post is enough to cover many use cases of D to C string interop.

The blog:
https://dlang.org/blog/2021/05/24/interfacing-d-with-c-strings-part-one/

Reddit:
https://www.reddit.com/r/programming/comments/njyf76/interfacing_d_with_c_strings_part_one/

May 24, 2021

I always think there is something wrong with the JS of D blog site.
I can't use chrome to open it.

May 24, 2021

I always think there is something wrong with the JS of D blog site.
I can't use chrome to open it.

May 24, 2021

On Monday, 24 May 2021 at 14:02:14 UTC, Mike Parker wrote:

>

The latest post in the D and C series dives into the weeds of D and C strings:

Thanks, I wasn't even aware of this.
However, I wish the behavior would be the same between string bounded storage variables and string literals.
I think this would be a good use case for multiple alias this where we would map d types to c types and vice versa.
For strings, it would in case of D->C just add the \0 at the end and for C->D it would be subtracted from the string.

>

There are at least two more posts worth of information to go into on this topic, but everything in this post is enough to cover many use cases of D to C string interop.

Which posts did you think of?

May 24, 2021

On Monday, 24 May 2021 at 15:10:46 UTC, sighoya wrote:

> >

There are at least two more posts worth of information to go into on this topic, but everything in this post is enough to cover many use cases of D to C string interop.

Which posts did you think of?

I describe them in the Conclusion:

>

In Part Two, we’ll look at how mutability, immutability, and constness come into the picture, how to avoid a potential problem spot that can arise when passing GC-allocated D strings to C, and how to get D strings from C strings. We’ll save encoding for Part Three.

May 24, 2021

On Monday, 24 May 2021 at 15:03:20 UTC, zjh wrote:

>

I always think there is something wrong with the JS of D blog site.
I can't use chrome to open it.

I'm looking at it in Chrome right now. Are you saying it doesn't open at all for you or there are rendering issues, or...?

May 24, 2021

loading all the time, loading for a long time, but also only part of the load, and still turn the circle.
just like there is a BIG js file .

May 24, 2021

but ie can open it.
it's strange.

May 25, 2021
Use the dev tools, network + performance tabs could be very useful information for debugging this.
May 24, 2021
use chrome ,cannot open the DEV.
press `F12` of no use.
`Alt+U`of no use.
continue rotating the small circle.You can do nothing.
« First   ‹ Prev
1 2 3