Question about GCC / GDC / LDC syntax of inline asm advanced

Iain Buclaw ibuclaw at gdcproject.org
Fri Jul 7 12:12:15 UTC 2023


On Friday, 7 July 2023 at 11:39:44 UTC, Iain Buclaw wrote:
> On Thursday, 6 July 2023 at 23:11:08 UTC, Cecil Ward wrote:
>>[...]
>
> The first part is parsed as an 
> [AssignExpression](https://dlang.org/spec/expression.html#assign_expressions), so you could have:
>
> ```
> asm {
>   (test ? "if-true-insn" : "if-false-insn")
>   ~ buildAsmString(foo, bar)
>   ~ test2() ? enumInsnTrue : enumInsnFalse // assign-expression 
> finishes here
>   : output-constraints
>   : ...
> }
> ```
> It's only at semantic-time that a "string-literal" result is 
> enforced using CTFE.
>

As shown in compiler explorer: https://d.godbolt.org/z/eTqvW8o8E


More information about the Digitalmars-d mailing list