Generic memory allocation in D
claptrap
clap at trap.com
Sat Mar 9 15:47:48 UTC 2024
On Saturday, 9 March 2024 at 00:09:38 UTC, Walter Bright wrote:
> It's not about performance, it's about competing notions of
> clarity.
If you see the sentence "If file read", it reads like "if the
file has been read".
That's the clarity you want.
The fact that you felt the need for a comment "//failed" on the
next line belies the fact that on some level you understand that
the preceding if statement is not obvious at first sight.
The simple and straight forward solution is
if (File.read(name, buf) == false)
return null;
More information about the Digitalmars-d
mailing list