quote:Original post by Anonymous Poster
GrinningGator: inline/__force inline only works in VS pro ed or?
I''m sorry, I don''t know if inline only works in VS pro or not. You''d have to check the docs on that, or maybe somebody with more experience will pipe up.
quote:Original post by Magmai Kai Holmlor
There are dozens of things macros can do that functions, even templated and/or inlined ones, cannot.
Very true. Perhaps I came across too strongly. There are of course times where macros are very useful and even desired. I have even been known to use them in my own code. But there are many common usages (many illustrated in this thread) where they offer no advantage and many dangers. I have learned this first hand and only seek to pass on my limited knowledge so that others can avoid my mistakes.
quote:Original post by stefu
It could be dangerous, but I am programmer!
I''m not trying to argue that if something is dangerous, it should never be used. If something is dangerous AND there is a safer way to accomplish the same task, why use the dangerous way? I was trying to point out the safer alternative ways to accomplish the same thing that macros posted earlier were designed to do.
If this had been a thread about cool things you could do with pointers, perhaps I would have posted a warning about how there are many dangers using pointers and offered suggestions about how you might avoid some of the pitfalls without sacrificing functionality/performance.
That link I posted before has a good discussion of what the author means when he says something is "evil". It doesn''t mean you never use it, it means if you have to use it (and you
will use macros at some point if you''re a C++ programmer) you have to use it with a conscious understanding of all the pitfalls.
quote:Original post by Anonymous Poster
"multiple argument evaluation is a problem"
Really? I''ve used many many arguments with no problems.
Of course you can pass multiple arguments to a macro. By "multiple argument evaluation" I meant that an argument might be evaluated more that once when the macro is expanded. This could be very bad if you called a macro with "x++" (or another expression with side effects) as an argument. dorix posted an illustration of that earlier. Perhaps I should have said "arguments evaluated multiple times".