Is there a way to slice non-array type in @safe?

Stefanos Baziotis sdi1600105 at di.uoa.gr
Fri Jul 12 08:59:57 UTC 2019


Thank you all for your responses. I understand that the compiler
can't ensure @safe and @trusted is needed.. I'm not familiar 
though with all aspects of D and thought I might have missed 
something.

On Friday, 12 July 2019 at 01:24:06 UTC, Jonathan M Davis wrote:
> BTW, if you're implementing memcmp, why are you using byte 
> instead of ubyte? byte is signed. Unless you're explicitly 
> trying to do arithmetic on integral values from -127 to 127, 
> odds are, you shouldn't be using byte. If you're doing 
> something like breaking an integer into its 8-bit parts, then 
> ubyte is what's appropriate, not byte.
>

I usually start with the signed version and if in the end there's 
no need for the
signed, I make it unsigned. In this case, at the moment there's 
no actual
need for `byte`. Actually, it only makes difficult to use some 
GDC intrinsics.



More information about the Digitalmars-d-learn mailing list