Click here to Skip to main content
15,914,066 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionTo MACRO or not to MACRO Pin
BadKarma14-Jun-07 22:33
BadKarma14-Jun-07 22:33 
AnswerRe: To MACRO or not to MACRO Pin
Rob Graham15-Jun-07 2:19
Rob Graham15-Jun-07 2:19 
GeneralRe: To MACRO or not to MACRO Pin
Pete O'Hanlon15-Jun-07 8:42
mvePete O'Hanlon15-Jun-07 8:42 
GeneralRe: To MACRO or not to MACRO Pin
CPallini15-Jun-07 11:48
mveCPallini15-Jun-07 11:48 
GeneralRe: To MACRO or not to MACRO Pin
alex.barylski22-Jun-07 20:01
alex.barylski22-Jun-07 20:01 
AnswerRe: To MACRO or not to MACRO Pin
Ed.Poore18-Jun-07 1:16
Ed.Poore18-Jun-07 1:16 
AnswerRe: To MACRO or not to MACRO Pin
Stephen Hewitt20-Jun-07 22:30
Stephen Hewitt20-Jun-07 22:30 
AnswerRe: To MACRO or not to MACRO Pin
alex.barylski22-Jun-07 19:59
alex.barylski22-Jun-07 19:59 
Macros are processed at pre-compile time, so they serve a purpose of course. Think the ASSERT in MFC. Can't do that with inlined functions. Well you could, but what a waste.

MACROS some might argue, are bad practice. Personally, there have been many times while programming in JS or PHP where I have considered running my code through a pre-processor to gain the benefits of macro expansion.

Ask any interpreted language developer with experience in C/C++ and they'd likely agree.

When you program OOP, everything is an object, at least in a purists eyes. Using inline functions would seem messy and pointless. Are you going to throw all generic functions inside a class named CGeneric and call them statically?

That would be hack, IMHO.

In those cases where you need some simple code, that is common in more places than a single class, Macros are a good thing. Most Macros that I have used, such as LOWORD, etc...make sense as a macro, not an inlined function...

So to answer your question, no Macros are not evil, the developers who use them inappropriately are. Smile | :)

There are times when I write code, that is clean and effective but could be slightly more elegant or efficient if I could use a GOTO (no longer the case in most languages). I think macros, globals, goto's and even multiple inheritence can still be useful, but their use has to be completely understood and justified, otherwise they promote bad coding practice and you end up with crap.

Then again, I've seen purist OO code with-out macros, globals, goto, or MI and it was crap too.

Cheers Smile | :)

I'm finding the only constant in software development is change it self.

AnswerRe: To MACRO or not to MACRO Pin
sonofdelphi25-Jun-07 22:46
sonofdelphi25-Jun-07 22:46 
AnswerRe: To MACRO or not to MACRO Pin
me_stargazer6-Jul-07 1:58
me_stargazer6-Jul-07 1:58 
QuestionAnalyst Qyery Pin
monas_2914-Jun-07 3:59
monas_2914-Jun-07 3:59 
AnswerRe: Analyst Qyery Pin
Paul Conrad4-Nov-07 7:10
professionalPaul Conrad4-Nov-07 7:10 
QuestionClass Design Pin
Akbar Ali Hussain13-Jun-07 1:21
Akbar Ali Hussain13-Jun-07 1:21 
AnswerRe: Class Design Pin
Dave Kreskowiak13-Jun-07 4:32
mveDave Kreskowiak13-Jun-07 4:32 
GeneralRe: Class Design Pin
Akbar Ali Hussain18-Jun-07 0:42
Akbar Ali Hussain18-Jun-07 0:42 
GeneralRe: Class Design Pin
Dave Kreskowiak18-Jun-07 2:27
mveDave Kreskowiak18-Jun-07 2:27 
QuestionHelp required in polymorphism Pin
rohan198111-Jun-07 18:16
rohan198111-Jun-07 18:16 
AnswerRe: Help required in polymorphism Pin
led mike12-Jun-07 4:47
led mike12-Jun-07 4:47 
GeneralRe: Help required in polymorphism Pin
Fatbuddha 112-Jun-07 23:55
Fatbuddha 112-Jun-07 23:55 
AnswerRe: Help required in polymorphism Pin
Dave Kreskowiak13-Jun-07 4:26
mveDave Kreskowiak13-Jun-07 4:26 
GeneralRe: Help required in polymorphism Pin
rohan198113-Jun-07 18:06
rohan198113-Jun-07 18:06 
GeneralRe: Help required in polymorphism Pin
rohan198113-Jun-07 18:10
rohan198113-Jun-07 18:10 
GeneralRe: Help required in polymorphism Pin
Dave Kreskowiak14-Jun-07 2:27
mveDave Kreskowiak14-Jun-07 2:27 
GeneralRe: Help required in polymorphism Pin
Ed.Poore18-Jun-07 1:18
Ed.Poore18-Jun-07 1:18 
QuestionHelp required in polymorphism Pin
rohan198111-Jun-07 18:15
rohan198111-Jun-07 18:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.