Dynamic array comparison optimization: check for equal pointers?

Patrick Schluter Patrick.Schluter at bbox.fr
Wed Jun 3 05:53:20 UTC 2020


On Wednesday, 3 June 2020 at 05:48:56 UTC, Patrick Schluter wrote:
> On Tuesday, 2 June 2020 at 19:38:04 UTC, Johan wrote:
>> [...]
>
> memcmp() doesn't implement the check to avoid memcmp(NULL, 
> NULL, length) returning with 0 instead of segfaulting as it 
> does if any of the 2 pointers in NULL.
> It's a case of consistant behaviour, either you tolerate NULL 
> pointers in all cases or you segfault in all cases.

https://stackoverflow.com/questions/16362925/can-i-pass-a-null-pointer-to-memcmp



More information about the Digitalmars-d mailing list