Basic question about size_t and ulong

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Mar 22 21:23:43 UTC 2022


On Tue, Mar 22, 2022 at 09:11:00PM +0000, Era Scarecrow via Digitalmars-d-learn wrote:
[...]
> I'd almost wish D had a more lenient mode and would do automatic
> down-casting, then complain if it *would* have failed to downcast data
> at runtime.
[...]

We already have this:

	import std.conv : to;
	int x;
	long y;
	y = x.to!long;	// equivalent to straight assignment / cast
	x = y.to!int;	// throws if out of range for int


T

-- 
Gone Chopin. Bach in a minuet.
I see that you JS got Bach.


More information about the Digitalmars-d-learn mailing list