Safe to throw away function arguments with cast?

2008-12-04 Thread Brian
Is it safe to cast a function(or delegate) into one that takes more arguments, causing those arguments to be ignored? Example: void fn() { } auto fptr = cast(void function(int, int))fn; fptr(1, 2); // It seems to work with a simple test case, I'm just afraid of it blowing up at me later on.

Re: Safe to throw away function arguments with cast?

2008-12-04 Thread Jarrett Billingsley
On Thu, Dec 4, 2008 at 10:37 AM, Brian [EMAIL PROTECTED] wrote: Is it safe to cast a function(or delegate) into one that takes more arguments, causing those arguments to be ignored? Example: void fn() { } auto fptr = cast(void function(int, int))fn; fptr(1, 2); // It seems to work with

Re: Safe to throw away function arguments with cast?

2008-12-04 Thread Denis Koroskin
On Thu, 04 Dec 2008 18:37:10 +0300, Brian [EMAIL PROTECTED] wrote: Is it safe to cast a function(or delegate) into one that takes more arguments, causing those arguments to be ignored? Example: void fn() { } auto fptr = cast(void function(int, int))fn; fptr(1, 2); // It seems to work with