if parameter never used, is ldc smart enough to remove it ?
Newbie2019
newbie2019 at gmail.com
Sat Jul 13 06:33:35 UTC 2019
for example:
void enforce(bool val, string file = __FILE__, size_t line =
__LINE__){
if( !val ) {
debug printf("%s, from line %d\n", file.ptr, line);
abort();
}
}
__gshared int base = 10;
int somefn(int val, string file = __FILE__, size_t line =
__LINE__) {
enforce(val > 0, file, line);
return val + base ;
}
void main(){
int i = somefn(1);
}
when build for release, will the parameter reduce into 1 for
function somefn && enforce ?
and how to verify this ?
More information about the digitalmars-d-ldc
mailing list