When I was going through source of qt4.2 I was just pulled by the implementation of 'foreach' esp for compilers without typeof method.
But I just couldn't understand as to why ternary operators are used when 0 could have been used directly. Am I missing something ? Can someone enlighten me ?

Qt Code:
  1. #define Q_FOREACH(variable, container) \
  2. for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
  3. qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \
  4. ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \
  5. for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \
  6. qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \
  7. --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk)
  8.  
  9. #endif
To copy to clipboard, switch view to plain text mode