I am porting some C++ code to GCC, and apperantly it isn’t happy with C++ style casting when sapces are involved, as in unsigned int(-1), long long(ShortVar) etc… It gives an error: expected primary-expression before 'long'.
Is there any way to make peace with GCC without going over each one of those and rewrite in c-style?
GCC is correctly crying —
unsigned int(-1)is a notation that is not conformant with the C++03 standard (5.4.2):Ergo, you can either correct the cast with the parenthesis, follow the excellent suggestions proposed by GMan 🙂 — and I’d truly recommend the latter.
Edit: the functional notation requires a simple-type-specifier:
Simple type specifiers do not include the composite ones (the ones with spaces).