float init 0 request

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Aug 19 16:26:49 UTC 2026


On Tuesday, August 18, 2026 1:44:49 PM Mountain Daylight Time H. S. Teoh via Digitalmars-d wrote:
> On Tue, Aug 18, 2026 at 12:24:16PM -0700, Walter Bright via Digitalmars-d wrote:
> [...]
> > Designing a programming language is full of compromises. We just have
> > to do the best we can.
> >
> > Unlike C, which uses chars as integer types, D has a distinct char
> > type. And so we can use the "invalid char value", or 0xFF, as its
> > default initializer.
>
> D might as well use integer types for char, because char, wchar, and
> dchar implicitly convert to non-character int types.  This happens even
> during overload selection: func(int) is preferred over func(dchar) when
> selecting an overload that calls `func` with a wchar argument.
>
> :-(

I think that we're still better off with having character types, because it
makes the code clearer, it does help with overloading (even if there are
still issues), and it helps with character and string literals.

However, I completely agree that the character types should not have been
treated as integer types at all (so explicit casts would be required to
convert them to any integer types), just like I think that bool should never
have been an integer type. We're probably stuck at this point though, and at
least in the bool case, Walter would never agree to stop treating it as an
integer type. The C way of dealing with boolean values is just too deeply
ingrained in him at this point.

- Jonathan M Davis






More information about the Digitalmars-d mailing list