[Issue 4475] Improving the compiler 'in' associative array can return just a bool

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 7 06:28:08 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4475



--- Comment #3 from bearophile_hugs at eml.cc 2012-01-07 06:28:08 PST ---
(In reply to comment #2)
> From a semantic point of view, in needs to continue to return a pointer in
> regular D, or a boolean in SafeD.
> 
> But if it's well optimised, then in most use cases the generated code would end
> up the same in both cases.

I think "in" returning a pointer is a case of premature optimization. LDC shows
that in most real situations a compiler is able to optimize away two nearby
calls to the associative array lookup function into a single call. So I think a
better design for "in" is to always return a boolean, both in safe and unsafe D
code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list