[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 09:16:13 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13589

--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to yebblies from comment #3)
> 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.

It could be more serious. If someone want to write a kernel code with D, mixing
inline assembler and regular D code may be painful. It would be a serious flaw
against the goal "D is a system language".

> And templated functions often have attributes inferred, and then you'd have
> to mark the asm blocks by hand.  This will be inconsistent.

Yes, in template functions, asm with attributes is still useful.

> 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.

It is case by case. *In phobos*, it is less than 100 asm, but we would already
have large code base we are unknown. I believe D will be a widespread language,
so we should imagine the quite big use cases even they are not visible.

--


More information about the Digitalmars-d-bugs mailing list