www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - the naked keyword is an attribute - but it looks like an function

reply dennis luehring <dl.soluz gmx.net> writes:
naked INSIDE of the context which is adress with the attribute - looks 
very strange to me, because it changes the pro- AND epilog of an 
function/codeblock

real blabla(real x)
{
   asm{
     naked;
     mov EAX,[RSP];
     naked;
     add EAX,0x3fff;
     naked;
   }
}

wouldn't it be better to have something like

naked asm{
...
}

or

real blabla(real x) naked
{
   naked asm{
   }
}

or like delphi does

real blabla( x: real ) assembler
{
   mov EAX,[RSP];
   add EAX,0x3fff;
}
Feb 21 2011
parent "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 21 Feb 2011 12:45:21 +0300, dennis luehring <dl.soluz gmx.net>  
wrote:

 naked INSIDE of the context which is adress with the attribute - looks  
 very strange to me, because it changes the pro- AND epilog of an  
 function/codeblock

 real blabla(real x)
 {
    asm{
      naked;
      mov EAX,[RSP];
      naked;
      add EAX,0x3fff;
      naked;
    }
 }

 wouldn't it be better to have something like

 naked asm{
 ...
 }

 or

 real blabla(real x) naked
 {
    naked asm{
    }
 }

 or like delphi does

 real blabla( x: real ) assembler
 {
    mov EAX,[RSP];
    add EAX,0x3fff;
 }
Yes, naked applied to the whole function body, and I proposed to make it an external attribute because of that: http://www.mail-archive.com/digitalmars-d puremagic.com/msg22593.html
Feb 21 2011