I just found the exi开发者_Go百科stence of qt_noop()
define in the qglobal.h as:
inline void qt_noop() {}
What's the point of it?
The "noop
" name is short for "no operation", meaning it is a place-holder function that does nothing.
You may also know NOP
, which exists in assembly-language.
I know it's used internally in some macros that should do something only for debug builds, for example:
# ifndef QT_NO_DEBUG
# define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop())
# else
# define Q_ASSERT(cond) qt_noop()
# endif
#endif
精彩评论