Generic memory allocation in D
kdevel
kdevel at vogtner.de
Tue Mar 5 08:16:52 UTC 2024
On Tuesday, 5 March 2024 at 03:31:28 UTC, Walter Bright wrote:
> On 3/4/2024 2:57 PM, kdevel wrote:
>> And yesterday I found a post where an "is" function does not
>> return
>> a bool [2]:
>>
>> https://github.com/dlang/dmd/pull/16280/files
>> package CppOperator isCppOperator(const scope Identifier id)
>
> Correct, but it isn't that bad. The "is", when treated as a
> bool, gives a result that correctly answers the question.
Sure, but on the one hand that function is nowhere used as a
predicate. These are the only two invocations I found (in dmd
2.105.3):
cppmangle.d:
1216 // test for special symbols
1217 CppOperator whichOp = isCppOperator(ti.name);
1218 final switch (whichOp)
cppmanglewin.d:
1164 auto whichOp = isCppOperator(ti.name);
1165 final switch (whichOp)
whichOp is not used in boolean context either.
On the other hand after your rewrite of isCppOperator there are
different values which map to false:
old: enum CppOperator { Cast, Assign, Eq, Index, Call, Unary,
Binary, OpAssign, Unknown }
new: enum CppOperator { Unknown, Cast, Assign, Eq, Index, Call,
Unary, Binary, OpAssign }
More information about the Digitalmars-d
mailing list