Test pseudo-namespaces in C
In C you can create pseudo-namespaces by abusing structs of function pointers, making function calls look like `module.func(x)` instead of `func(x)`. A lot of people online spout that this creates overhead, but this should show that clang>=15.0.7 will still inline such function calls. GCC 11.3.1 is unable to inline the function, but will still call the function directly.
This commit is contained in:
10
dump.asm
Normal file
10
dump.asm
Normal file
@@ -0,0 +1,10 @@
|
||||
Dump of assembler code for function main:
|
||||
0x0000000000401130 <+0>: push %rax
|
||||
0x0000000000401131 <+1>: mov $0x402010,%edi
|
||||
0x0000000000401136 <+6>: mov $0x6,%esi
|
||||
0x000000000040113b <+11>: xor %eax,%eax
|
||||
0x000000000040113d <+13>: call 0x401030 <printf@plt>
|
||||
0x0000000000401142 <+18>: xor %eax,%eax
|
||||
0x0000000000401144 <+20>: pop %rcx
|
||||
0x0000000000401145 <+21>: ret
|
||||
End of assembler dump.
|
||||
Reference in New Issue
Block a user