Compiler hints, inlining and syntax consistency

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sat Dec 28 08:59:06 PST 2013


On Saturday, 28 December 2013 at 15:45:16 UTC, Dicebot wrote:
> It should be #keyword than, as existing #line is closest thing 
> to what you describe

Does it matter? I don't think #line is particularly close, it is 
just an annotation.

>> // allocate simd-aligned and 0-padded string by sacrificing 
>> memory for efficiency,
>> // if supported
>>
>> @simd string
>
> Bad example - it impacts program semantics a lot.

Not if done properly. Why would it?

>> // force loop-unrolling modulo 4 in order to trigger SIMD 
>> optimizations
>>
>> @unroll(4) for(…) {}
>
> Same here. Such stuff is done by compiler-specific attributes 
> or pragmas. It has no similarities with stuff like #foldregion 
> and should not be treated same.

Pragmas and compiler-specific attributes suck and makes code less 
readable. Inlining and unrolling is common enough to warrant 
support, otherwise programmers will do manual unrolling in 
inner-loops in order to get portable code.


More information about the Digitalmars-d mailing list