Google's take on memory safety
Lance Bachmeier
no at spam.net
Sun Mar 17 01:48:37 UTC 2024
On Saturday, 16 March 2024 at 18:47:40 UTC, harakim wrote:
> That seemed like a great goal, but obviously that couldn't be
> it because D would be a lot more popular. Now you say this is
> true!?
The thing is, it is only very recently that it works well enough
to be a practical way to incorporate C code into your project.
Initially it just compiled C code. The only problem is that
there's very little C code in the wild. It's a mix of C, the
preprocessor, and compiler extensions. Over time, that was
addressed, but the one remaining (big) limitation was that it
couldn't deal with function-like macros. Walter recently remedied
that, so for the first time you can grab a 10,000-line .c file
and have an expectation that it'll compile cleanly. The only
issue I've had is a minor bug that has an easy workaround. Other
than that, tens of thousands of lines of C code has compiled for
me. Note that right now you need to use the DMD release candidate
for 2.108.
> This is such an enormous benefit! This should be a huge driver
> for D. With this functionality, I could easily see it being the
> language of the year on tiobe, for example.
It's hard to predict usage, but it's a darn good tool for working
with a legacy C codebase. With module support, you can even add
import statements to your C files to import D functions. I've
used that in a couple cases to eliminate dependencies.
More information about the Digitalmars-d
mailing list