[Issue 13589] [git-head] Asm statement could be assumed to nothrow, safe, pure by the enclosing function attribute
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Oct 8 08:47:27 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13589
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies at gmail.com
--- Comment #3 from yebblies <yebblies at gmail.com> ---
(In reply to Kenji Hara from comment #1)
>
> And more, I'd disallow asm @safe {/*...*/} , because we already have the
> best attribute @trusted to assume the code as such.
Absolutely.
I don't agree with the rest of the proposal. Asm statements are fairly
infrequent and are rather dangerous, so I don't think the overhead of having to
explicitly attribute them is too much. They're usually nothrow, but purity and
safety are not such a given.
And templated functions often have attributes inferred, and then you'd have to
mark the asm blocks by hand. This will be inconsistent.
Grepping phobos shows ~ less than 100 asm statements, mostly in math and bigint
functions. I don't think use of asm statements is prolific enough to trade
explicitly guaranteeing attributes hold for less redundancy.
--
More information about the Digitalmars-d-bugs
mailing list