On 8/18/06, toni <topi23@xxxxxxxxx> wrote:
hello, > Has anyone an idea how to code following macro: > #define INIT() \ > > #ifdef THREDSAFE \ > > lock_mutex() \ > > #endif \ > maybe... #ifdef THREDSAFE #define INIT() lock_mutex() #else #define INIT() do {} while (0) #endif regards, toni
Yep, this is the best way to do it, so you can do fool things like if (foo) INIT(); bar();
> The error ist that after a # operator there is an parameter expected. > The normal escape doesn't help in this case. > > Shure I can write this in every line I need it but I want to have a > macro. > > CU > > Katharina > > > > > Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu > sparen! > http://smartsurfer.web.de/?mc=100071&distributionid=000000000071 -- toni <agar9938@xxxxxxxxxxxxxxxxxx>
-- What this world needs is a good five-dollar plasma weapon. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/