I was told to avoid using features of C++ like these as it makes it difficult to port the code to other compilers.
The example I was given was using #ifdef
instead of #pragma once
in my header files.
I was told to avoid using features of C++ like these as it makes it difficult to port the code to other compilers.
The example I was given was using #ifdef
instead of #pragma once
in my header files.
Well, this is challenging to answer, because each compiler is different - and, more specifically, #pragma statements are not a feature of C++. #pragma means, by definition "a command to send to the compiler":
"Pragmas are machine- or operating system-specific by definition, and are usually different for every compiler." MSDN
so, essentially, whenever you see #pragma, it means "what follows next is not part of the language standard, and so may be different for every platform you target/compile on"
Here's a list of nonstandard behaviour in VC++: http://msdn.microsoft.com/en-us/library/x84h5b78%28VS.71%29.aspx
Those are not "C++ features", they are non-standard "extensions", non-standard functions, and "compiler features" provided by compiler developer.
short and incomplete list of microsoft-specific features that will cause trouble during porting:
The very clean, but non-portable for each, in statement: http://stackoverflow.com/questions/197375/visual-c-for-each-portability