basics

Basic Structure of C++ Program -- Prashant Sharma

[Ed.: This is a simple short "hello world" overview for someone starting to program in C++, and is basically correct. There are lots of expert-friendly articles, but we like and want to encourage the beginner- and intermediate-level articles as well for the benefit of the many recent newcomers to the language.]

Basic Structure of C++ Program

The easiest way to understand the basic structure of C++ program is by writing a program. The basic C++ program is as follows: ...

Stroustrup & Sutter on C++: Mar 31 - Apr 1, San Jose, CA, USA

eelive.PNGFor the first time in several years, Bjarne Stroustrup and Herb Sutter will hold a two-day seminar on C++

Super C++ Tutorial: Stroustrup & Sutter on C++

EE Live!
March 31 - April 3, 2014
San Jose, CA, USA

Are you a serious C++ developer? The two-day Super C++ Tutorial, taught by Herb Sutter and Bjarne Stroustrup, the creator of C++, is designed for active C++ developers, embedded systems developers, and anybody who works with the language on a regular basis and wants to write faster, more efficient code for applications ranging from data centers to mobile platforms where all-day battery life is key.

We invite you to spend two insightful and informative days as the instructors present the most important things C++ developers need to know in 2014. The two days are designed to cover a balanced curriculum of information: useful for C++ developers at any level, with helpful information whether you’ve only used C++ for a year or two or are a top C++ guru; balanced between language and standard library topics; covering today’s modern techniques and best practices together with forward-looking information about new features coming and expected to be broadly available in the next year; panels where both speakers share their insights and perspectives with each other and answer your questions; and much more, with the deep context and expertise that these instructors uniquely bring.

Quick Q: Why is there a nonmember begin(), but no nonmember cbegin()? -- StackOverflow

Quick A: There is, in C++14.

From SO:

Is there a way to use standalone std::begin and for a const_iterator?

I like consistency. I recently asked the question of using std::begin vs. e.g. std::vector<int>::begin, and the unanimous decision seemed to be to use the former since it is more general. But I think I found a stick in the mud. Sometimes, you want to convey you will not change a container as you loop through it, hence calling std::vector<int>::cbegin. It would make your code quite asymmetric if you sometimes did iter = v.cbegin() and other times did iter = begin(v). Is there a way around this lack of symmetry, and would you still recommend std::begin given this knowledge? Why does C++ not have std::cbegin?

Core C++ #10 -- Stephan T. Lavavej

core-10.PNGAccompanying today's release of the VC++ CTP, there is a new talk by Stephan T. Lavavej available covering several major C++11 and draft C++14 features that are of likely interest to C++ developers using any compiler.

Core C++, 10 of n (Nov 2013 CTP)

by Stephan T. Lavavej

From the summary:

In part 10, STL explores the new features in the Visual C++ Compiler November 2013 CTP (Community Technology Preview), in addition to the features that were added between VC 2013 Preview and RTM.

Features included in the November CTP ( generic lambdas!!! Smiley ):

C++11, C++14, and C++/CX features:

  • Implicit move special member function generation (thus also completing =default)
  • Reference qualifiers on member functions (a.k.a. "& and && for *this")
  • Thread-safe function local static initialization (a.k.a. "magic statics")
  • Inheriting constructors
  • alignof/alignas
  • __func__
  • Extended sizeof
  • constexpr (except for member functions)
  • noexcept (unconditional)
  • C++14 decltype(auto)
  • C++14 auto function return type deduction
  • C++14 generic lambdas (with explicit lambda capture list)
  • (Proposed for C++17) Resumable functions and await

Meeting C++ 2013

The recent Meeting C++ 2013 was a blast, the 2nd Meeting C++ conference was with over 200 guests a full success!

Meeting C++ 2013

by Jens Weller

Additional Online Resources:

Stephen Kelly about CMake for Qt and Boost

The talks from Peter Sommerlad

Sven Johannsens HTML based talk about STL11 is online.

Available slides are linked in the talk descriptions.

Learn How To Program... with C++ -- Kate Gregory

kate-gregory-v2.jpgDo you know a beginner who'd like to learn C++? Or even just learn how to program... using C++?

Recently, C++ author and trainer Kate Gregory made a new 7-hour course available via Pluralsight. And not just any introductory course, but teaching C++ the way it should be taught... not "C and pointers first."

It's highly-rated, as with all of Kate's courses. Know about it and recommend it to newcomers.

Learn How to Program with C++

Instructor: Kate Gregory

If you've never programmed before, and you think you'd like to learn C++, why not learn it first? This course covers what you need to start writing real applications in C++.

Why does C++ not allow multiple types in one auto statement? -- StackOverflow

Recently on SO:

Why does C++ not allow multiple types in one auto statement?

The 2011 C++ standard introduced the new keyword auto, which can be used for defining variables instead of a type, i.e.

auto p=make_pair(1,2.5);                   // pair<int,double>
auto i=std::begin(c), end=std::end(c);     // decltype(std::begin(c))

In the second line, i and end are of the same type, referred to as auto. The standard does not allow

auto i=std::begin(container), e=std::end(container), x=*i;

when x would be of different type. My question: why does the standard not allow this last line? ...

Compiling and Linking in C++ -- Rusty Ocean

Selection_101.pngLife'n'gadget just published a nice overview of the basic C++ compilation model, useful for people who are new to programming in C++.

Compiling and Linking in C++

by Rusty Ocean

From the article:

When you write a C++ program, the next step is to compile the program before running it. The compilation is the process which convert the program written in human readable language like C, C++ etc into a machine code, directly understood by the Central Processing Unit. There are many stages involved in creating a executable file from the source file. The stages include Preprocessing, Compiling and Linking in C++...