(git HEAD) std.datetime spewing deprecation messages

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 5 15:42:29 PDT 2014


On Thursday, 5 June 2014 at 22:06:02 UTC, monarch_dodra wrote:
> On Thursday, 5 June 2014 at 08:49:18 UTC, Jonathan M Davis via 
> Digitalmars-d
>>    long days;
>>    int seconds;
>>    short msecs;
>>    d.split!("days", "seconds", "msecs")(&days, &seconds, 
>> &msecs);
>
> Please don't use pass-by-pointer in D APIs. It makes it a real 
> *nightmare* to ever use the code in a safe context. Besides, we 
> have ref. The only arguments "for" pass by pointer afaik are:
> - retain existing/C api (1)
> - allow null pointers   (2)
>
> (1) is not applicable, I think.
> (2) would only make sense if split did not have a template 
> parameter, and took "all" arguments, and only filled the 
> non-null ones.
>
> So, please make these pass by ref.

Even better than ref would be out which guarantees that the input 
parameter values do not affect the function.


More information about the Digitalmars-d mailing list