[...]
Note: the "-std=c++98 -pedantic" flags ensure that you are compiling
according to the current C++ standard without any GCC-specific extensions/
restrictions to the language.
Note that the "-std=c++98 -pedantic" flags only affect the
compiler, and do *not* ensure that you are not including
non-standard headers or linking against non-standard libraries.
Something like:
#include <unistd.h>
int
main()
{
static char const h[] = "Hello, world!\n" ;
read( 1, h, sizeof(h)-1 ) ;
return 0 ;
}
will compile and link, with those flags, on my system, but is
anything but standard C++. (It is standard Posix, however
.)
On most (all?) Unix platforms, the C standard library and the
Posix standard library are merged in a way that makes it
impossible to separate them. (I'm not aware of an option for
VC++ which would make #include <windows.h> illegal either.)
With regards to the original question, concerning writing an
application in "standard" C++, the only real answer it to start
by documenting what is standard C++, and what isn't, and then
use a lot of personal discipline. Having two systems at your
disposition, one Windows and one Unix, and ensuring that all of
the code compiles and runs on both, helps a lot too. (But note
that both systems tend to have features to help migration from
the other, so it's not really a guarantee either.)