Re: Porting issues: Visual Studio and gcc
On 6 Sep., 10:28, Andrew <marlow.and...@googlemail.com> wrote:
On 3 Sep, 17:32, Kenneth Porter <shiva.blackl...@sewingwitch.com>
wrote:
Has anyone gathered a list of issues encountered when porting code that
compiles with Visual Studio to gcc or other more strict compilers? (I don't
mean platform-dependent stuff like special keywords. I'm interested in
things I might mis-code thinking they're legal because VS doesn't
complain.)
Are there other issues that others have encountered that I should watch for
when I'm coding under Windows?
Yes. The Microsoft compilers turn SEGV etc into C++ exceptions. This
means that catching exceptions by the base class will inadvertantly
catch these cases. There is a way to programatically turn this
behaviour off but obviously, such code is non-portable (you can
surround it with #if WIN32...#endif).
I am not sure what do to about this other than turn the behaviour off.
Any other suggestions gratefully received :-)
You should specify /EHs (Code Generation/Enable C++ Exceptions)
instead of the default settings (/EHa). Also consider to use
/EHsc, if you want the compiler to assume that all extern "C"
functions never throw an exception. Using these settings in the
IDE I do not see a reason why the code itself shouldn't be
portable.
HTH & Greetings from Bremen,
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]