Vote for the new std.hash (oops, std.digest)

Johannes Pfau nospam at example.com
Mon Aug 27 04:39:54 PDT 2012


Am Mon, 27 Aug 2012 01:49:12 +0300
schrieb Manu <turkeyman at gmail.com>:

> Though that said, looking at the API doc for finish(), it appears to
> return a dynamic array, not a static array as you say... so ubyte[]
> could be used everywhere, and that would be nice and clear?
> 

That's the Digest / OOP APIs finish method. As all finish methods in
the OOP API must have the same return type so ubyte[] is used. The
drawback is that the data is allocated using the GC unless a buffer was
explicitly passed to finish.

The template API uses ubyte[n] and can therefore return the value using
stack space and no allocations.

I made another pass through the docs and replaced auto where possible.
I also added another simple example.


More information about the Digitalmars-d mailing list