Struct member functions emit unnecessary call to _d_assert_msg
    Daniel Murphy 
    yebbliesnospam at gmail.com
       
    Fri Jan 24 20:09:48 PST 2014
    
    
  
"Mike"  wrote in message news:lxusmgyievzioacmgwmc at forum.dlang.org...
> What bothers me is the branch at <bb 2>. It looks like it's checking the 
> struct instance to see if it is null. Is it even possible for it to be 
> null?  Can this be improved?
It's checking if the 'this' pointer is null.  Syntactically it's a 'this' 
_reference_, but it can still be null.
void MyFunction()
{
     TestStruct *test;
     test.Print()
}
> I imagine in a tight loop (for example, an alpha blend function on an 
> array of pixels), this can be a significant performance hindrance if every 
> call has to make this check.
It should disappear when compiled with '-frelease'. 
    
    
More information about the D.gnu
mailing list