|
Boost : |
Subject: Re: [boost] [Spirit-general] construe_cast, call for interest and feedback
From: Jeroen Habraken (vexocide_at_[hidden])
Date: 2010-10-07 17:59:05
On 7 October 2010 22:43, Aaron Graham <aaron_at_[hidden]> wrote:
> I'm excited about construe_cast. I always liked the flexibility of
> lexical_cast, but tend not to use it as much as I could because of its
> performance relative to other mechanisms.
> Does gcc still convert "23" at compile time if you disable builtins?
> (-fno-builtin)
>
#include <boost/construe_cast.hpp>
int main(int, char**) {
return boost::construe_cast<int>("23");
}
compiled using gcc 4.5.1, g++-4.5 test.cpp -o test -O3 -I . -I
../library/boost-trunk/ -fno-builtin will generate the following code:
Dump of assembler code for function main:
0x0000000100000e20 <main+0>: push %rbp
0x0000000100000e21 <main+1>: mov $0x17,%eax
0x0000000100000e26 <main+6>: mov %rsp,%rbp
0x0000000100000e29 <main+9>: leaveq
0x0000000100000e2a <main+10>: retq
0x0000000100000e2b <main+11>: nopl 0x0(%rax,%rax,1)
thus as you can see, it's still able to perform the optimization.
Jeroen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk