44
55[ _ fqname_ ] ( fqname.md ) __ (__ ` ( ` [ _ argument_list_ ] ( argument_list.md ) ` ) ` __ )?__
66
7+
78## Semantics
89
910If the [ _ fqname_ ] ( fqname.md ) is a single name,
1011then this attribute is required. A required attribute must be handled by the compiler.
1112If the compiler does not know how to handle the attribute it is an error.
1213
13- If the [ _ fqname_ ] ( fqname.md ) has the ` std ` prefix
14+ If the [ _ fqname_ ] ( fqname.md ) has the ` std. ` prefix
1415it is a well-known optional attribute. These attributes don't change the semantic
1516meaning of the program, instead they are directives to the compiler to create
1617better code.
1718
1819Other prefixes are attributes that are handled by specific compilers. Compilers
1920should ignore any attributes that do not match their own prefix.
2021
21- ### abi()
22+ ### abi(x )
2223Make this function available for linking with an application written in a
2324different language; using a different ABI (Application Binary Interface).
2425
25- - __ c__ : Use the C ABI.
26- - __ cpp__ : Use the C++ ABI.
26+ On a type this will change how the memory layout is for an object.
27+
28+ - "c": Use the C ABI. (same as aligned)
29+ - "c++": Use the C++ ABI. (same as aligned)
30+ - "aligned": Keep members in a struct in given order, and align members.
31+ - "reorder": Reorder members in a struct, pack while maintaining alignment. (default)
32+ - "pack": Keep members in a struct in given order, ignore natural alignment of members. This will
33+ cause member access to use possible slower, but valid, unaligned access.
34+ - "compress": Use niche-mask to further compress members in a struct. Access to members may
35+ require shifts and masks.
2736
2837### no_return
2938This function will not return.
@@ -37,22 +46,24 @@ Pre-condition is checked before calling the function.
3746### post()
3847Post-condition is checked after calling the function.
3948
49+ A post-condition on a type will run after an object is modified.
50+
4051
4152### std.no_inline
4253Calls to this function are never inlined.
4354
4455This is a strong optimization lever:
4556 - It reduces code size by not inlining the code, which will reduce
46- code -cache usage.
57+ instruction -cache usage.
4758 - It significantly reduce register pressure, which will reduce the
4859 amount of reads/writes to memory. And may in turn reduce size of the
4960 code; which in turn may allow more inlining.
5061
51- ### std.depricated, std.depricated()
62+ ### std.depricated, std.depricated(msg )
5263This function is depricated print a warning. A reason for deprication can
5364be passed as a constant-string.
5465
55- ### std.discard
66+ ### std.discard, std.discard(msg)
5667The return value of this function is allowed to be discarded by the caller.
5768
5869Discarding a return value is:
0 commit comments