Does dmd have SSE intrinsics?

Christopher Wright dhasenan at gmail.com
Tue Sep 22 16:14:34 PDT 2009


Jeremie Pelletier wrote:
> Why would you declare void variables? The point of declaring typed 
> variables is to know what kind of storage to use, void means no storage 
> at all. The only time I use void in variable types is for void* and 
> void[] (which really is just a void* with a length).
> 
> In fact, every single scope has an infinity of void variables, you just 
> don't need to explicitly declare them :)
> 
> 'void foo;' is the same semantically as ''.

It simplifies generic code a fair bit. Let's say you want to intercept a 
method call transparently -- maybe wrap it in a database transaction, 
for instance. I do similar things in dmocks.

Anyway, you need to store the return value. You could write:

ReturnType!(func) func(ParameterTupleOf!(func) params)
{
	auto result = innerObj.func(params);
	// do something interesting
	return result;
}

Except then you get the error: voids have no value

So instead you need to do some amount of special casing, perhaps quite a 
lot if you have to do something with the function result.



More information about the Digitalmars-d mailing list