System programming in D (Was: The God Language)

Artur Skawina art.08.09 at gmail.com
Wed Jan 4 07:39:41 PST 2012


On 01/04/12 16:31, Artur Skawina wrote:
> Functions attributes seems like it could be an easy, backward compatible addition:
> 
> @attr(attributes...)
> 
> then define some obvious generic attributes like "inline" (which is (always|force)_inline, as it's the only one that makes sense), "noinline", "hot", "cold" etc. This lets you write "@attr(inline) int f(i){}" etc, but doesn't help the vendor specific attr case at all, unfortunately. [2]

User defined attributes. 

"@attr regparm=whatever_the_compiler_uses;", conditioned on version(). 

Would let you do "@attr(regparm) int f(int i){}" in a portable way. Still not sure i like it, but could work. Would have to accept and expand to multiple attrs though...

artur


More information about the Digitalmars-d mailing list