A Programmer's Dilema: juggling with C, BetterC, D, Macros and Cross Compiling, etc.
Dukc
ajieskola at gmail.com
Mon May 1 09:23:18 UTC 2023
As others have said, you have no reason to restrict yourself to
BetterC. If you dislike objects and/or other high-level features,
you can simply use D in a low-level way like you'd use C. That
works just as well from normal D as from BetterC. Both the C
standard library and third-party C libraries are available in
both cases.
And I do encourage that over time you gradually try the
high-level features you don't have in C or even BetterC. It's
likely you won't like all of them, and that's fine. For instance,
it's pretty common for a D codebase to use object-oriented
programming and exception only minimally or not at all. Still,
almost certainly you will like something better than the C
equivalent. For example, I've heard no-one preferring the
`concat` function of C standard library over append operator
(`~`) of a D string, except when it's necessary to do without the
GC (and even then, A D programmer would likely devise something
that works with slices and non-zero-terminated strings rather
than `concat`).
On Sunday, 30 April 2023 at 18:15:31 UTC, Guillaume Piolat wrote:
> You could use BetterC for sure, but it's more practical in the
> long term to just learn to live with the GC: it is a one-time
> mental cost.
Plus, even if you were to avoid the garbage collector, BetterC is
not needed for that.
You want BetterC only if you want to avoid depending on DRuntime
at all - maybe to write a library to be used from C or to write
code to a platform without DRuntime port. And even in those
cases, you have alternative ways to accomplish the same.
More information about the Digitalmars-d-learn
mailing list