1
vote
4answers
172 views

Learning programming from a book which uses C++98 [closed]

I am learning programming from a book called "Programming Principles and Practice" by Bjarne Stroustrup. It has been highly recommended over here and elsewhere. My only issue is that it uses C++98 and ...
1
vote
0answers
150 views

Binary Tree/Knowledge Base design C++

Currently I have a binary tree template setup where my main is using it with strings to make a question/answer game. I'm using a knowledge base that works as an interface to the binary tree that main ...
4
votes
3answers
364 views

What are my options for using a C++11 library in a C# WPF application? [closed]

I am writing a cross-platform (OS X and Windows) desktop application in C++11. I intend to use the same C++11 core on both platforms, utilizing native frameworks for the UI (Cocoa and Objective-C on ...
8
votes
3answers
565 views

Style guide for C++

Right now I am using Google C++ Style Guide in my C++ code and I was pretty happy with it. Recently I was told that this guide is very bad: it is used internally by Google (I knew that), is outdated, ...
3
votes
2answers
200 views

Intersection of geometric entities

I was trying to design a small C++ geometric API for learning purposes, but came across a problem when dealing with intersections of geometric entities. For example, the intersection of a line and a ...
2
votes
3answers
284 views

Can compilers check whether certain axioms hold for a user defined type?

Suppose the following type is defined (C++ syntax, can be conceptually applied to any statically typed language.) class T { int val; friend bool operator<(const T& lhs, const T& rhs) ...
3
votes
2answers
557 views

How to deal with pointers from child to parent?

I have a class that represents a file in specific binary format on disk (the parent in the title) and another class that represents an object inside that file (child). When the object changes, it ...
1
vote
4answers
1k views

Help with learning the C++ Qt Framework

I've been a longtime PHP web developer. But now I've reached the limits and web doesn't fascinate me anymore. I am interested in learning cross-platform development. I have learned Java for almost a ...
8
votes
2answers
512 views

Would Task-based programming in C++ require new language standard features?

So I saw this video on Youtube with all these C++ masters on GoingNative 2012 : Interactive panel where everybody could ask the questions. This is the video I was talking about: GoingNative 2012 - ...
0
votes
3answers
1k views

Two-Dimensional vector in C++ – inefficient with dynamic-sized sub vectors?

I know that std::vector uses a contiguous block of memory, but I often see people use vectors of vectors, even when they modify the number of elements in these vectors contained within an outer ...
-2
votes
1answer
396 views

How can I learn to like C++? [closed]

I'm a wimpy web programmer by trade -- I enjoy programming in JavaScript, CoffeeScript, TypeScript, and Ruby. I have to program in C++ for my computer science degree, and it frustrates me. I don't ...
19
votes
4answers
5k views

Using scoped enums for bit flags in C++

An enum X : int (C#) or enum class X : int (C++11) is a type that has a hidden inner field of int that can hold any value. In addition, a number of predefined constants of X are defined on the enum. ...
16
votes
1answer
2k views

Motivation and pitfalls (?) of the auto keyword in C++11

I was recently wondering why the keyword auto was chosen in C++11 to mark a variable whose type must be inferred by the compiler, like in auto x = 1; Since var seems more common in other ...
72
votes
12answers
7k views

Does auto make C++ code harder to understand?

I saw a conference by Herb Sutter where he encourages every C++ programmer to use auto. I had to read C# code some time ago where var was extensively used and the code was very hard to ...
3
votes
2answers
427 views

How do .so files avoid problems associated with passing header-only templates like MS dll files have?

Based on the discussion around this question. I'd like to know how .so files/the ELF format/the gcc toolchain avoid problems passing classes defined purely in header files (like the std library). ...
15
votes
3answers
2k views

Did C++11 address concerns passing std lib objects between dynamic/shared library boundaries? (ie dlls and so)?

One of my major complaints about C++ is how hard in practice it is to pass std library objects outside of dynamic library (ie dll/so) boundaries. The std library is often header-only. Which is great ...
3
votes
2answers
492 views

Simplifying C++11 optimal parameter passing when a copy is needed

It seems to me that in C++11 lots of attention was made to simplify returning values from functions and methods, i.e.: with move semantics it's possible to simply return heavy-to-copy but ...
32
votes
4answers
5k views

How to make the switch to C++11?

I've been programming in C++ for a while now, but mostly things centered around the low-level features of C++. By that I mean mostly working with pointers and raw arrays. I think this behavior is ...
9
votes
5answers
1k views

How do you pronounce the '…' operator [closed]

Now, in c++ '...' became a first class operator. In speech, how do you pronounce it? So far I've heard: dot dot dot triple dot ellipsis related: Is it OK to replace ... with ellipsis in writing? ...
3
votes
3answers
949 views

How to setup the c++ rule of three in a virtual base class

I am trying to create a pure virtual base class (or simulated pure virtual) my goal: User can't create instances of BaseClass. Derived classes have to implement default constructor, copy ...
3
votes
3answers
709 views

What is use of universal character names in identifiers in C++

The C++ standard (I noticed it in the new one, but it did already exist in C++03) specifies universal character names, written as \uNNNN and \UNNNNNNNN and representing the characters with unicode ...
23
votes
11answers
5k views

I am a beginner. Can I directly start learning C++11? or I have to learn old C++? [closed]

I'm a beginner and have only little knowledge in programming. Would it be good if I directly learn C++ from books which cover new C++11 or should I study through the old best C++ books? Should I ...
3
votes
2answers
986 views

Can a compiled C++11 library (lib,dll,etc.) be linked in older C++ compilers?

Could older C++ compilers (e.g. VS2008 and gcc3.4) link with external libraries written in C++11? My thought is that the C++11 .lib files are just byte code at this stage, and it shouldn't bother the ...
2
votes
1answer
572 views

Using captured non-local variables in C++ closures

On this wikipedia page I have found the following sentence regarding closures in C++11: C++11 closures can capture non-local variables by copy or by reference, but without extending their ...
2
votes
4answers
1k views

C++ Iterator lifetime and detecting invalidation

Based on what's considered idiomatic in C++11: should an iterator into a custom container survive the container itself being destroyed? should it be possible to detect when an iterator becomes ...
9
votes
5answers
8k views

Should I use the new C++11 'auto' feature, especially in loops?

What are the pros/cons to using the auto keyword, especially in for loops? for(std::vector<T>::iterator it = x.begin(); it != x.end(); i++) { it->something(); } ...
7
votes
5answers
1k views

What is a good way to represent a many-to-many relationship between two classes?

Let's say I have two object types, A and B. The relationship between them is many-to-many, but neither of them is the owner of the other. Both A and B instances need to be aware of the connection; ...
11
votes
2answers
1k views

Best overview to modern C++ paradigms?

I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like "If you're still manually ...
8
votes
3answers
1k views

Achieving forward compatibility with C++11

I work on a large software application that must run on several platforms. Some of these platforms support some features of C++11 (e.g. MSVS 2010) and some don't support any (e.g. GCC 4.3.x). I ...
5
votes
6answers
836 views

Why is C++ backward compatibility important / necessary? [closed]

As far as I understand it is a wide-spread opinion within the C++ community that certain features of C++ (including some features inherited directly from C), while still usable in themselves, do not ...
56
votes
3answers
8k views

Is C++11 Uniform Initialization a replacement for the old style syntax?

I understand that C++11's uniform initialization solves some syntactical ambiguity in the language, but in a lot of Bjarne Stroustrup's presentations (particularly those during the GoingNative 2012 ...
27
votes
9answers
15k views

std::shared_ptr as a last resort?

I was just watching the "Going Native 2012" streams and I noticed the discussion about std::shared_ptr. I was a bit surprised to hear Bjarne's somewhat negative view on std::shared_ptr and his comment ...
2
votes
1answer
243 views

Is it good design to require class users to use Rvalue reference

I have the following situation where I have a base class and multiple polymorphics derived classes: #include <iostream> class Base { public: virtual void foo() = 0; }; class ...
17
votes
10answers
16k views

Why would I learn C++11, having known C and C++?

I am a programmer in C and C++, although I don't stick to either language and write a mixture of the two. Sometimes having code in classes, possibly with operator overloading, or templates and the oh ...
28
votes
6answers
5k views

What does the latest “C++ Renaissance” mean? [closed]

There's recently some voice about C++ renaissance, among which the most noteworthy one is from Herb Sutter, Chairman of the C++ Standard Committee. You can search for "C++ renaissance" on Google and ...
2
votes
3answers
515 views

Is C++0x Compatible with C?

I have heard that there will be a lot of changes done in C++ because of the new standard (C++0x). My question is: What are the major changes, and will C++0x be compatible with C++ 98 and C ?
43
votes
12answers
2k views

Philosophy behind Undefined Behavior

C\C++ specifications leave out a large number of behaviors open for compilers to implement in their own way. There are a number of questions that always keep getting asked here about the same and we ...
3
votes
3answers
744 views

What is the necessity to go for lambda functions and expressions in C++?

What is the necessity to use lambda functions and expressions in C++? Can you explain or show through examples how to use lambda functions and expressions? I already gone through the related ...
6
votes
4answers
1k views

Will all compilers start supporting C++0x as soon as it is officially out?

It's sometimes frustrating to know that one particular feature is working in one compiler and not in another. Even after downloading latest gcc4.6 few weeks back some C++0x features are not working. ...
3
votes
1answer
172 views

Will the portions of Boost that are incorporated into the new C++ standard continue to be developed?

What will happen to the portions of the Boost library that are incorporated into the new C++ standard? Will they continue to evolve and any changes be reincorporated into the standard which follows ...
21
votes
8answers
2k views

Deprecation considered harmful? [closed]

I've just been compiling some of my own code with the -std=c++0x flag in GCC, as I want to vaguely keep up with what all the young folks are doing (provided they stay of my lawn), and I ended up with ...