short programme from "Programming in D" by Ali Cehreli.

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 14 10:37:53 PDT 2016


On 06/14/2016 09:09 AM, Steven Schveighoffer wrote:

 >>     readf (" %s, &die");
 >>     // "No argument for %s"
 >>
 >> This is a desired feature but dmd does not have this yet. Since dmd
 >> provides the front end to gdc and ldc, they don't have this feature
 >> either.
 >
 > Hm... shouldn't it at least require ONE parameter besides the string?
 >
 > -Steve

Good idea in this case but I think the real issue is providing this 
support for user-defined functions as well.

bool argument_check_function(/* ... */) {
     // ...
}

pragma(arg_check, argument_check_function)
int foo(int, string);

I guess it's possible to do something with UDAs as well but the check 
must happen at call sites, which I think UDAs can't reach.

Ali



More information about the Digitalmars-d-learn mailing list