
Hans Larsen wrote:
BOOST_SCOPE_EXIT { // ... } (msc-only) I'm not going to implement this. And I'm not even going to study Steven's asm code. Sorry, Steven ;-)
versus BOOST_SCOPE_EXIT( (hello)(world) ) { // ... } (on everything) is a clear choice for me. With BOOST_SCOPE_EXIT_END in the end, it is my favorite at present. It fails on msvc in some cases so I'm going to fix it in non-portable way but a) only for msvc b) with much less asm
What's needed is somehow get a value of ptr without referencing it by name (because it depends on __LINE__ but we don't know its value): params_t params(hello, world); void* ptr = ¶ms; // definitions etc but no stack manipulations scope_exit_t scope_exit = { ptr }; // get rid of ptr here! scope_exit_t has a user-defined dtor and no virtual functions. There is only one memory allocation on the stak after ptr allocation - the scope_exit object construction. May be I could reserve a register at the second line and use it at the last line? Names of registers don't depend on __LINE__! -- Alexander Nasonov http://nasonov.blogspot.com It is never okay to throw away veteran underwear. A real guy checks the garbage regularly in case somebody - and we are not naming names but this would be his wife - is quietly trying to discard his underwear, which she is frankly jealous of, because the guy seems to have a more intimate relationship with it than with her. -- Dave Barry -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote