std.digest can't CTFE?

Manu turkeyman at gmail.com
Fri Jun 1 01:12:35 UTC 2018


Hashing's not low-level. It would be great if these did CTFE;
generating compile-time hashes is a thing that would be really useful!
Right here, I have a string class that carries a hash around with it
for comparison reasons. Such string literals would prefer to have CT
hashes.

On 31 May 2018 at 15:40, Jonathan M Davis via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Thursday, May 31, 2018 14:29:13 Manu via Digitalmars-d wrote:
>> "CTFE
>> Digests do not work in CTFE"
>>
>>
>> That's an unfortunate limitation... why is, those things? :(
>
> If I had to guess without looking at the code? I would guess that it's doing
> various casts to hash stuff, and no kind of reintpret cast is allowed in
> CTFE. But really, you'd have to actually run the code, see what works and
> what doesn't, and look at each error you get when it doesn't to see what
> it's doing that can't be done during CTFE. Depending on what it's doing, it
> may be possible to make it work during CTFE, or it may not. CTFE can do a
> lot, but there's also a lot that it can't do - especially if you start doing
> anything low level.
>
> - Jonathan M Davis
>


More information about the Digitalmars-d mailing list