Should pure nothrow ---> @pure @nothrow ?
Don
nospam at nospam.com
Fri Nov 27 02:58:59 PST 2009
Denis Koroskin wrote:
> On Fri, 27 Nov 2009 12:50:19 +0300, bearophile
> <bearophileHUGS at lycos.com> wrote:
>
>> Walter Bright:
>>> Naked is not an externally visible attribute of a function, signature or
>>> type, it only concerns the internals. Therefore, it shouldn't be an
>>> attribute.
>>
>> On the other hand I agree with them that currently "naked" is not in
>> the best place. So let's try another alternative:
>>
>> void foo() {
>> @naked asm {
>> ...
>> }
>> }
>>
>
> No, it applies @naked to an asm block, which is misleading: naked should
> be applied to the whole function body.
Yes, but if a function is naked, it should be illegal for it to contain
any non-asm executable code. The compiler can't generate correct code
when it's in a naked function. For all it knows, the function might even
have swapped stack pointers!
I believe D is quite correct in making 'naked' an asm instruction. Not
all CPUs might support it. (It's only relevant for CPUs/compilers where
a frame pointer is used).
> void foo()
> @naked body
> {
LOL! Spam filters would love that!!
More information about the Digitalmars-d
mailing list