Pizer’s Weblog

programming, DSP, math

Books, Books, Books (on C++)

with 5 comments

I already said it once in another post but I think it deserves to be mentioned again: Don’t underestimate the usefulness of good books about C++! Prefer buying a good book over searching the internet for tutorials, examples, explanations if you want to learn the language and/or learn about useful idioms, guidelines, etc…

I recently added two other books to my personal library: “Effective C++” and “C++ Coding Standards”. It took me only 3 weeks to finish both books. That means they were interesting and insightful. 🙂

Now, it’s these four C++ books that are in my posession:

  • The C++ Programming Language (Special Edition) by Bjarne Stroustrup
  • Modern C++ Design by Andrei Alexandrescu
  • Effective C++ (Third Edition) by Scott Meyers
  • C++ Coding Standards by Herb Sutter & Andrei Alexandrescu

I wouldn’t mention them here if I didn’t like them. 🙂

– P


Written by pizer

February 22, 2009 at 2:01 am

Posted in Programming

Tagged with , , ,

C++0x: concepts & rvalue references — 2nd round

with 4 comments

Last update: 2009-02-1

Concepts and rvalue references are two new features that are going to be included in the next official version of the C++ language with high probability. I’m not going to mention the basics behind those two features because it has been done before in other articles. Try this google video or this article for an introduction to concepts by Doug Gregor and this article for an introduction to rvalue references by Howard Hinnant et al.

I already wrote a post on concepts and rvalue references here which discussed some problems when concepts are combined with rvalue references. It turned out that David Abrahams and Doug Gregor were also aware of the first issue I addressed. They published an article one day before I wrote about it. In this post I’m going to address other arguments (consistency and intuitivity) for why I think their proposed resolution is a good idea and what other language modification can increase consistency. Before I go into the last bit I will shed some light on what function requirements actually mean and how they can be satisfied.

Update 2009-02-1:[ It turns out you can’t exprapolate the meaning of function requirements from the concept_map checking rules because they don’t cover all use cases in constrained contexts (see hole in concepts system). So, keep this in mind while reading the rest of this article.]

Read the rest of this entry »

Written by pizer

January 8, 2009 at 7:04 pm

Writing portable C and C++ code

leave a comment »

Width and value ranges of Integer types

C and C++ only specify minimum requirements regarding the width and value range of different integer types and how these are converted to each other. If you want to write portable code you should be aware of this. Check out the article Integer Types in C and C++.

Read the rest of this entry »

Written by pizer

December 18, 2008 at 5:11 pm

C++0x: Interaction between rvalue references & concepts

with 2 comments

Last update: 2008-12-08

I noticed some unfortunate gotchas when using two of the upcoming C++ features together: Rvalue references and concepts/templates. One of these problems can actually be seen in the currend draft of the future C++ specification. As far as I can tell, it looks like a subtle but nasty bug. Check out chapter 23.2.6 [vector, page 826]:

Read the rest of this entry »

Written by pizer

December 6, 2008 at 6:44 pm

scope guards revisited [C++0x style]

with 7 comments

If you havn’t heard about scope guards you might want to have a look at this ddj article. The idea of scope guards is to provide a convenient tool for resource management when exception safety is an issue. Of course you can always try to write little special-purpose classes and create instances on the stack so that some specific (“cleanup”) action is performed in the destructor. Sometimes it’s just tedious to have to write those special classes and you wish for a tool that lets you get away without them. That’s a situation where the scope guard idiom could help you.

Read the rest of this entry »

Written by pizer

November 22, 2008 at 3:42 pm

C versus C++

with 2 comments

I know that this is a sensitive subject that has been beaten to death already. Still, I’d like to share my opinion on this. Let me open with a quote by Bjarne Stroustrup about comparing programming languages which can be found in his FAQ:

Read the rest of this entry »

Written by pizer

October 29, 2008 at 4:20 pm

Fun with C++ namespaces [sarcasm]

leave a comment »

Last update: 2008-10-28.

I usually tend to defend C++ but name lookup is probably one of the most complicated things in C++ to wrap your head around. Namespaces are supposed to make your life easier. They provide means to group certain things together, to avoid name clashes between two parts of your program that might have been developed independently. Since typing fully qualified names is tedious people like to use short cuts: using directives and using declarations. So far so good. How well does this work together with generic programming?

Read the rest of this entry »

Written by pizer

October 22, 2008 at 5:21 pm