C++ macros with define or inline? -


possible duplicate:
inline functions vs preprocessor macros

inline functions introduced in c++ replace c style macros (#define macroname...), still, see lots of c++ code using old c style macros rather inlined functions, inlined function inferior old c style macros?

i macros inferior inlined functions.

inlined functions type safe , macros not. that's big advantage of them. compiler helping make better code.

with said, there few things macros can functions cannot. there not many of these things though...

i believe c programmers used macros , continue habits c++.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -