Jump to content
Nytro

C++0x feature support in GCC 4.5

Recommended Posts

Posted

[h=1]C++0x feature support in GCC 4.5[/h]

Arpan Sen (arpansen@gmail.com), Independent author

Summary: If you're one of the many users of the GCC C++ compiler, you should be aware of the new features that the upcoming C++0x specification has in store and available in GCC version 4.5.

Introduction

The GNU Compiler Collection (GCC) is the C++ compiler to the vast majority of us and has taken the lead in supporting features from the upcoming C++0x standard (see Resources for links to more information). This article focuses on a subset of several C++0x features that GCC version 4.5 supports, including static assertions, initializer lists, type narrowing, newer semantics of the auto keyword, lambda functions, and variadic templates. Some of these features—like static assertions—first made their appearance in GCC version 4.3, while lambda functions first appeared with the 4.5 release. If you intend to be one of the early adopters of C++0x, consider getting a copy of the draft standard and download GCC 4.5 (see Resources).

Let's begin by briefly discussing parts of the C++0x standard that are not yet supported in GCC

Static assertions

Remember those times when your portable code crashed at a customer site,

because integer sizes were not the 4 bytes you assumed them to be? The

static_assert construct in C++0x helps track precisely these kind of problems,

except that they are available at compile time and immensely useful when you need

to migrate sources to different platforms. Boost libraries (see Resources) have had

support for static assertions for some time now, but having static assertions

integrated as part of the language core (static_assert is a C++0x keyword)

implies that headers are no longer needed (see Listing 1).

...................................

Download:

http://public.dhe.ibm.com/software/dw/aix/au-gcc-pdf.pdf

Online:

http://www.ibm.com/developerworks/aix/library/au-gcc/index.html

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...