
31 Aug
2007
31 Aug
'07
2:11 a.m.
From: Neal Becker I want to use this like logging - where I can switch it off at compile time and make the overhead negligible.
I wrote a simple test function: int test() { bounded_int<int, -3, 7>::type b(5); b++; b -= 1; return b; } I compiled it with gcc 4.01, optimisations turned on. I had to add explicit 'inline' to several functions, and then the assembler output was as follows: __Z4testv: LFB1019: pushl %ebp LCFI17: movl $5, %eax movl %esp, %ebp LCFI18: popl %ebp ret I dare to say it couldn't be optimised more now... ;-) Best regards, Robert