Petter Kvalvaag
Petter Kvalvaag

Reputation: 363

#if defined WINDOWS vs #if defined(WINDOWS)

Does enclosing the definition in parenthesis make any difference?

I'm asking because the Qt moc compiler crashes when it sees the latter variant enclosed in parenthesis and WINDOWS is defined.

Update: Upgraded from Qt 5.4.2 to Qt 5.6 and I no longer see the problem.

Upvotes: 2

Views: 331

Answers (1)

Jesper Juhl
Jesper Juhl

Reputation: 31475

No, there is no semantic difference in this case. But moc's understanding of both C++ and preprocessing directives is somewhat limited, so it can often be necessary to tweak some constructs to please its simple mind.

In this case you could also use #ifdef WINDOWS for identical results.

Upvotes: 4

Related Questions