Re: Define a larger code block

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote in message news:DB8275F0-3EFA-48D2-9C44-C70D4CD8A69C@xxxxxxxxxxxxxxxx
Hi Doug,

You're right in general of course, but I still think macros are handy for lots of things like:

#define LogCriticalEvent(val) theApp.LogEventObject._LogEvent(#val, val,

Sees user identifier starting with underscore+capital and shudders...

_T(__FUNCTION__), __LINE__, 0, true)

Where this would be more difficult to do in a function. I kind of miss being able to do this sort of thing when writing C# code :o)

Tom

"Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote in message news:16k2a3hojomr6k9q9g79mfjchh9joll1p5@xxxxxxxxxx
On Fri, 20 Jul 2007 15:18:02 -0700, Alan <Alan@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

Hi,

As I can define something like

#define ABC(x) if(x){x = NULL;}

but how can I define something similar but the code block is relatively
large (like several lines testing different cases, etc)?

Thanks,
Alan

FWIW, in C++, you should almost always write inline functions instead of
macros.

--
Doug Harrison
Visual C++ MVP


.



Relevant Pages

  • Re: Define a larger code block
    ... You're right in general of course, but I still think macros are handy for ... Sees user identifier starting with underscore+capital and shudders... ... but how can I define something similar but the code block is relatively ...
    (microsoft.public.vc.language)
  • Re: A challenge for RosAsm
    ... > - on cost of 'direct readability' ... > And I never would hide any code block, ... Macro Purpose is. ... To me, the HLL Macros should be used, mainly, for HLL- ...
    (alt.lang.asm)
  • Re: Define a larger code block
    ... You're right in general of course, but I still think macros are handy for lots of things like: ... but how can I define something similar but the code block is relatively ... Visual C++ MVP ...
    (microsoft.public.vc.language)
  • Re: Define a larger code block
    ... You're right in general of course, but I still think macros are handy for ... you have to use macros for that. ... say that when you have a choice, inline functions are preferable to macros. ... Visual C++ MVP ...
    (microsoft.public.vc.language)
  • Re: Define a larger code block
    ... but how can I define something similar but the code block is relatively ... macros. ... Doug Harrison ... Visual C++ MVP ...
    (microsoft.public.vc.language)