   Macro question
  Is there any way to have a macro span multiple lines?   
  \   ;  Just to be a bit more explicit, a \ at the end of a line escapes the newline. Multi-line macros are one of the few places this trick comes in handy.If you are using C++, be aware that there are usually superior options to macros. If you tell us what the macro is supposed to do, we might be able to show you a nicer and safer alternative.   ;  It's worth pointing out that \ will also escape the end of C++ comments.  I've heard horror stories of bugs caused by accidentally escaping the ends of a comments that took weeks to find.   ;Quote:Original post by ZipsterIt's worth pointing out that \ will also escape the end of C++ comments.  I've heard horror stories of bugs caused by accidentally escaping the ends of a comments that took weeks to find.Now that I was not aware of.  Thanks for sharing [smile]   ;  Well macros can be usefull for small things that get called over and over, that wouldn't really make since to put in a function and pass all the data you need the same every time. So I thought I would use macros.   ;Quote:Original post by 3DModelerManWell macros can be usefull for small things that get called over and over, that wouldn't really make since to put in a function and pass all the data you need the same every time. So I thought I would use macros.Usually, inline or template functions get you the same benefits, with type safety and other benefits too.Again, if you show us the macro, we can tell you how it might be replaced.   ;Quote:Original post by 3DModelerManWell macros can be usefull for small things that get called over and over, that wouldn't really make since to put in a function and pass all the data you need the same every time. So I thought I would use macros.I will bet you $20 that your compiler (assuming it's gcc or MSVC) can optimize better than you can.  Don't make things a macro just because they're small.  Macro's are an absolute nightmare to debug and they lack type safety and scope.  Any decent compiler will inline such a small function and optimize the @#$% out of your code :)As Donald Knuth said: "Premature optimization is the root of all evil."   ;  Huh I guess so. Thanks.   