Future of memory management in D

Nick Treleaven nick at geany.org
Thu Nov 18 14:31:36 UTC 2021


On Thursday, 18 November 2021 at 06:25:29 UTC, rumbu wrote:
> Lol. Look, C# is not a garbage collected language:
>
> int* x = stackalloc int[100];
> int* y = Marshal.AllocHGlobal(1000);
> struct RC<T> where T: struct { ... }
>
> O course, metaprogramming makes things easier in D, but 
> pretending that D is not a garbage collected language when you 
> cannot join two arrays or throw an exception without digging  
> outside the language for a replacement is absurd.

@nogc unittest
{
	import std.container.array;
	auto a = Array!int(1, 2);
	auto b = Array!int(3, 4);
	a ~= b;
	import std.algorithm;
	assert(a[].equal([1,2,3,4]));

	static const ex = new Exception("hi");
	throw ex;
}



More information about the Digitalmars-d mailing list