1

What does pure C++ mean? Please explain the different versions of C++ like Visual C++ and GNU C++.

How about compilers for these types of C++?

Mat
  • 202,337
  • 40
  • 393
  • 406
user881703
  • 1,111
  • 3
  • 19
  • 38
  • Pure C++ is the basic language. Anything else are library (whether standard or not) addons. Please refine the question. –  Apr 09 '12 at 05:48

4 Answers4

9

Pure C++ means C++ as per the ISO standard, with none of the vendor-specific extensions being used.

That means it should be portable across all implementations that support the standard. Otherwise you may find yourself locked in to a specific vendor, not necessarily a bad thing, but you should understand the implications of that decision.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • *portable across ALL implementations that are the same endianness unless you don't do any I/O. Endianness is the greatest evil ever created for portability :-( – std''OrgnlDave Apr 09 '12 at 06:02
3

Pure C++ is the form of C++ which only uses semantics defined by the ISO C++ standard.
The code implemented in Pure C++ is fully portable accross all Standard compilant C++ compilers.

Implementations are allowed to provide their own extensions over the features provided by the C++ standard. Each compiler provides so in the form of compiler extensions.

Thus,

Pure C++ = Features provided by Standard C++
Visual C++ = Features provided by Standard C++ + MSVC compiler extensions.
GNU C++ = Features provided by Standard C++ + GNU compiler extensions.

Alok Save
  • 202,538
  • 53
  • 430
  • 533
2

There is no such thing as "Pure C++". Either it's C++ or it's not. There are some companies that have made extensions to C++, that have new keywords like "WinMain", which are not part of the C++ standard. Perhaps that's what you're referring to.

  • 1
    Microsoft has added a LOT of extensions to C++. I had to be careful about the semantics of a class named 'event' because they decided they wanted plain, unqualified, no _ before it, just 'event' as a keyword (but sort of let you use it anyway for other stuff). How stupid is that? VERY stupid! But it's beside the point. – std''OrgnlDave Apr 09 '12 at 05:52
  • 1
    Yeah C++ is complex enough without Microsoft adding to it. It's a big mess really. – Esteval Del Toro Apr 09 '12 at 05:58
  • 2
    Especially in MSVC2k10. I get compile-time warnings with templates sometimes because IntelliSense can't figure out an instiation. Why do I care exactly? What does IntelliSense have to do with the actual compilation? I will end my rant now. – std''OrgnlDave Apr 09 '12 at 06:01
  • WinMain is the typical name given to the entry point for a GUI based Windows application. – lee-m Apr 09 '12 at 11:22
  • Yeah I'm just wondering the accurate term for it is if not a keyword, so I can edit my answer. I know it's not a big deal I just want to make sure I don't confuse anybody. – Esteval Del Toro Apr 09 '12 at 11:57
0

Stanley Lipman describes the terminology Microsoft invented for their C++/CLI hybrid at http://msdn.microsoft.com/en-us/magazine/cc163852.aspx :

C++/CLI represents an integration of the Kansas and Oz of native and managed programming. In this iteration, that has been done through a kind of separate but equal community of source-level and binary elements, including Mixed mode (source-level mix of native and CTS types, plus a binary mix of native and CIL object files), Pure mode (source-level mix of native and CTS types, all compiled to CIL object files), Native classes (can hold CTS types through a special wrapper class only), and CTS classes (can hold native types only as pointers).

So, "Pure" C++ in a Microsoft world is a term for a specific blend of proprietary features and ISO Standard C++ features.

Stanley's description differentiates it from "Native" - which matches what other existing answers to this question describe as "pure". In the general English usage of the word, of course "pure" would be "native" = ISO Standard. Ostensibly, Microsoft picked a blatantly misleading term, such that people following tutorials/references on "Pure C++" may be unknowingly locking themselves and their code into use of proprietary Microsoft extensions, and therefore frustrated in any later attempts to port them to other Operating Systems.

terms C++ like Visual C++ and GNU C++. How about compilers for these types of C++.

Visual C++ is Microsoft's brand name for their C++ and C++/CLI compiler. GNU is an organisation that produces myriad open-source software products including GCC - the GNU Compiler Collection, which includes a C++ compiler.

Tony Delroy
  • 102,968
  • 15
  • 177
  • 252