Ian Malone wrote:
Karl Larsen wrote:
I was told there is only one kind of C++ in Linux. I was surprised and looked at man gcc and direct that person to the section headed:
Options Controlling C Dialect
The following options control the dialect of C (or languagesderived from C, such as C++, Objective-C and Objective-C++) that the compiler accepts:
Unfortunately only one of these is C++[1][2]. By dialect they mean the standard used for each one. In C mode that means whether to support the C90 or C99 standards and whether gnu and other extensions to the language should be supported. Which can have interesting effects on the availability of GNU or Posix functions like getopt. The C++ mode will do the equivalent for that language.
-ansi In C mode, support all ISO C90 programs. In C++ mode,remove GNU extensions that conflict with ISO C++.
This is what I was in referance to. I wonder what C Dialect Windows uses?
MS own dialect. They tend to choose (particularly with C++) what bits to support and what not to and like all other compiler vendors will provide their own extensions. Further support varies between the different versions. Visual C++ 6 was notorious for some bits of its C++ support, though many of these were later patched.
I can only really speak about C, not C++, but in both MS and GCC compilers support for the latest version of the C99 standard is not complete (N.B. that some parts will require support in the underlying library, glibc for GNU). Some parts of the standard are implemented as extensions.
The best way to stay safe in terms of portability is to stick to the published standard and run your compiler in conforming mode, but often confounding factors will make this difficult.
[1] Attempts to treat C++ as a superset of C eventually lead to pain. [2] Objective-C++? I'd like some of whatever they're having please.
When I was MUCH younger and using an old Fortran because that was what we had, I learned about the subtle changes you can make by a simple change. I tried to compile some of my old code on the Linux Fortran 97 and they would all error out. I fixed them and it was not too hard. Around 1970 I got interested in C. I still have books of that vintage and was amazed that Unix was made with C. At that time I think ANCI C was in style.