
Sorry, I have no compiled this at all. Thanks Sebasian for pointing me this C++ feature that I ignored completly. And Joaquin, bravo for the trick. The macros defined on the article use a wrapper of the variable that has two methods done_post_step and post_step, but the Joaquin solution seems to me much better. It is a pleasure to exchange on the Boost ML. Thanks to boths, Vicente ----- Original Message ----- From: "Sebastian Redl" <sebastian.redl@getdesigned.at> To: <boost@lists.boost.org> Sent: Tuesday, January 20, 2009 10:53 PM Subject: Re: [boost] A PP trick to define a synchronizedblock java-like macro JOAQUIN M. LOPEZ MUÑOZ wrote:
________________________________________ De: boost-bounces@lists.boost.org [boost-bounces@lists.boost.org] En nombre de Sebastian Redl [sebastian.redl@getdesigned.at] Enviado el: martes, 20 de enero de 2009 22:39 Para: boost@lists.boost.org Asunto: Re: [boost] A PP trick to define a synchronized block java-like macro
vicente.botet wrote:
for (VARS DECLARATION, bool __continue=true; __continue; __continue=false)
I'm afraid this is not valid syntax. The first clause of the for-statement is a for-init-statement, which can be either an expression with a semicolon, or a simple-declaration. A simple-declaration lets you declare any number of variables, but they must all have the same declspec, i.e. the same fundamental type (with variations like "pointer to", "array of" or "function returning").
The following variation would do:
for (VARS DECLARATION, *continue_hlp_,**continue_=&continue_hlp_; continue_; continue_=0)
This is brilliant! Weird workaround at its best.