C++ types

Ian Malone ibmalone at gmail.com
Sun Sep 2 21:07:21 UTC 2007


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 languages derived
>       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.

-- 
imalone




More information about the fedora-list mailing list