D as A Better C?

Kagamin spam at here.lot
Thu Feb 13 10:38:19 PST 2014


On Tuesday, 11 February 2014 at 19:43:00 UTC, Walter Bright wrote:
> The subset would disallow use of any features that rely on:

I found it manageable to write bare metal code with stock LDC and 
no additional options. It doesn't require C runtime, malloc is 
only 6 lines and returns ubyte[] already. LDC actually had 
-noruntime option, which was only getting in the way. Some 
functions from druntime are useful, e.g. _d_array_cast_len, which 
allows simple casting between different types of buffers.

> 1. moduleinfo

I use bounds checks, and they call _d_array_bounds, which takes 
ModuleInfo as a parameter. How it would work?

> 2. exception handling

I think asserts are sort of useful.

> 4. Object

I didn't try to use objects without GC, but don't see any 
particular issue.

> I've used such a subset before when bringing D up on a new 
> platform, as the new platform didn't have a working phobos.
>
> What do you think?

Not urgent: LDC already allows me to use D without druntime, 
phobos and C library.


More information about the Digitalmars-d mailing list