Greetings,
The following code seems to create a new function call:
module test;
void main(char[][] args)
{
return function(int i) { return i+2; }(1);
}
compiled with dmd test.d -inline
At least objdump of the .o file contains:
RELOCATION RECORDS FOR [.text._Dmain]:
OFFSET TYPE VALUE
00000009 R_386_PC32 _D4test4mainFAAaZv14__funcliteral1FiZi
which looks like a additional function to me. Though I must mention that I
don't really know how correct my interpretation of these information is.
Using nested functions, it seems to get inlined:
module test;
void main(char[][] args)
{
int tmp(int i)
{
return i+2;
}
return tmp(1);
}
I was wondering if this is correctly interpreted by me and if yes, why it
isn't inlined? I would expect that inlining function() {} () would even be
more easy than a nested function because it is used only at one place.
--Marenz
--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/