Interesting. Thank you to both of you.

On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven Schveighoffer wrote:
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki) Andrew Cattermole wrote:
Place your attributes on the right hand side of the function, not the left side.

Use the left side for attributes/type qualifiers that go on the return type.

Just a word of warning, this explanation suggests putting qualifiers on the left side would affect the return type, this is not the case.

So in my example, what did I actually tell the compiler with the placement of the attributes? And how was it different between the function type alias declaration, and the actual function declaration?

More specifically, what are the semantic differences below?
```d
alias FnPrefixT = @nogc nothrow @safe bool function(int);
// Versus
alias FnSuffixT = bool function(int) @nogc nothrow @safe;
```
and
```d
@nogc nothrow @safe bool fnPrefix(int) { stuff }
// Versus
bool fnSuffix(int) @nogc nothrow @safe  { stuff }
```
Is there a reasonably clear overview of how this works anywhere? What I have seen so far led me to the vague impression that it wasn't significant just like attribute ordering.

-- john



  • How can I tell D... John Dougan via Digitalmars-d-learn
    • Re: How can... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: How... Steven Schveighoffer via Digitalmars-d-learn
        • Re:... John Dougan via Digitalmars-d-learn
          • ... Steven Schveighoffer via Digitalmars-d-learn
            • ... John Dougan via Digitalmars-d-learn
              • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... John Dougan via Digitalmars-d-learn
              • ... Monkyyy via Digitalmars-d-learn

Reply via email to