Questions about C++, a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

learn more… | top users | synonyms

3
votes
2answers
2k views

What is the advantage of using map datastructure?

I am a member of some online coding website and today when I submitted a solution in C++, I saw there were much better answers in C++ itself which took considerably less time. The solutions were open ...
5
votes
7answers
1k views

What keywords are important to speedup the code in C++?

I'm porting to C++ and adding a lot of functionality to a numerical application written in Fortran 77. While I hate F77, I have to admit that the thing goes very fast. Now, I'm implementing ...
1
vote
3answers
424 views

Should non-interface code be hidden from the client?

I am working on a library which had several headers that are meant to only be used by the library itself. I also have a few classes and functions in headers that I do not want the client to use. For ...
2
votes
2answers
3k views

Fastest C++ XML parsing library

I have thousands of .xml files from size 1MB-45MB (no DTDs). I need to parse and further manipulate these XML files before generating separate .xml files with the results of my regex. What the ...
5
votes
8answers
1k views

Why has the rate of programming language popularization slowed down in recent decades? [closed]

If I understand correctly, there was a huge birth of programming languages during the early decades of computing, but then things have stabilized. Basically, why are many universities and industries ...
6
votes
1answer
689 views

Delegation and MetaClass in C++

We have an OOP course at our university, while discussing the concepts I came across MetaClass and Delegation. As far as I know, these don't exist in C++. Could someone give an example by which I can ...
10
votes
8answers
2k views

What should I expect from a technical evaluation for C++? [closed]

I have been asked to go for a technical test/evaluation for a job as a junior developer, mainly using C++. This is my first test/evaluation, and it is 2 hours long. My C++ is a bit rusty as I have ...
9
votes
8answers
6k views

How is C different from C++?

Many people have said that C++ is a completely different language than C, but Bjarne himself has said that C++ is a language that is extended from C hence that is where the ++ comes from. So why does ...
18
votes
6answers
779 views

Does adding unit tests make sense for well-known legacy code?

I'm talking about unit tests in the TDD sense. (Not automated "integration", or what you like to call it tests.) Legacy code as in: (C++) code without tests. (see: Michael Feathers' Working ...
3
votes
4answers
1k views

Is this a pattern? Should it be?

The following is more of a statement than a question - it describes something that may be a pattern. The question is: is this a known pattern? Or, if it's not, should it be? I've had a situation ...
1
vote
1answer
299 views

Designing Subclasses for an abstract base class in C++

I'm doing a small assignment in C++ where I have to use concepts like virtual functions and inheritance in a domain of my choice. I'm implementing the prototype for a package manager in Linux. I have ...
6
votes
2answers
600 views

Thread class design?

I have a method like this in my UI code: void MyDialog::OnCommandSaveData() { std::list<MyClass*> objects; service_->GetAll(objects); dataService_->SaveObjects(objects); ...
4
votes
2answers
165 views

How to keep settings for C++ Unit Test modules in sync with the production code modules?

Note: I'm coming from a Windows / Visual-C++ background. Note: I have already read Michael Feathers' Working Effectively with Legacy Code. Note: Broad question, asking for narrow answers, i.e. while ...
23
votes
3answers
5k views

Why are exception specifications bad?

Back in school some 10+ years ago, they were teaching you to use exception specifiers. Since my background is as one of them Torvaldish C programmers who stubbornly avoids C++ unless forced to, I only ...
0
votes
6answers
5k views

C++: Spaces vs Tabs [duplicate]

Possible Duplicate: Tabs versus spaces—what is the proper indentation character for everything, in every situation, ever? I have always used tabs in all my code (C, C++, python etc.) but I ...
2
votes
2answers
304 views

Best practice for shared files within multiple unit test fixtures

I was wondering what the general best practice is for when you have multiple unit test fixtures testing different things that use the same file paths. My test files are in a directory tree with ...
20
votes
13answers
3k views

Is Systems Hungarian notation still a useful practice? [closed]

I searched the forum, but I couldn't find the answers why it should be avoided, only why it's not a silver bullet. So I don't think this question is a duplicate. Is there a VALID reason why I should ...
5
votes
3answers
429 views

How can we verify that software meets specifications meets requirements?

So we're pretty good at eliciting requirements from our end customers, business division and sales/marketing. We plan projects to add/enhance features to meet those requests and prioritize tasks to ...
3
votes
7answers
5k views

Is there a common capitalization convention in C++? [closed]

I do a lot of work in Python and Java, and both those languages have fairly common (though not universal) conventions on how capitalization should be used in identifiers: both use PascalCase for class ...
32
votes
17answers
5k views

Teaching C++ to first time high school students: Where to draw the line?

I will be mentoring a team of high school students for the FIRST Robotics Competition, most teams here develop[ their robot software using C++. For many of the students on the team this will be their ...
12
votes
3answers
2k views

Where to start learning to use the Boost libraries?

Boost has recently become available on the project on which I'm working, and I don't have much experience with it. The library has so many parts and features that it's hard to know where to get ...
2
votes
1answer
160 views

Can anyone recommend a toolchain-agnostic way of declaring and documenting inter-package build dependencies?

I currently have a project at my hand that I'll leave soon (PhD work) and should be left in an understandable form since it is likely to be taken up, though it is not known yet by whom and when. ...
6
votes
3answers
3k views

Can anyone recommend a good robot kit for learning C++ robotics programming? [closed]

Preferably something that is a combination of affordable and close to real world robotics programming and will allow me to program it with C++.
13
votes
7answers
1k views

Does C# experience translate well to C++?

My programming classes in school were C++, but I ended up working a job doing C# for the last few years. If there was a position that required say 1 or 2 years experience in C++, would my experience ...
10
votes
4answers
898 views

How should I bring my C++ back up to date with modern developments?

How should I bring some very rusty C++ up to date, as I'm sure the language and best practices have evolved? I realise this might be close to being off-topic so let my clarify some details. About 10 ...
53
votes
14answers
9k views

Why would it ever be possible for Java to be faster than C++?

Sometimes Java outperforms C++ in benchmarks. Of course, sometimes C++ outperforms. See the following links: http://keithlea.com/javabench/ ...
18
votes
10answers
5k views

Why is Java considered more portable than other languages like C++?

What differs between "writing a specific JRE for each platform" for Java developers and "writing a C++ compiler for each platform" for C++ ones?
4
votes
4answers
698 views

What are the arguments for/against Code Generation?

I'm in a position where we've got some brittle code that constructs SQL-like queries via text concatenation with parameters for inputs. The data source that it queries is fast and scalable but lacking ...
6
votes
4answers
2k views

Is there a general rule for when you should use 'make clean' instead of just 'make'?

I am writing a multiple-filed program right now, and apparently running only 'make' (as one would intuitively think needs to be done in most situations) for some reason causes my program to fail. I ...
28
votes
13answers
2k views

Tutoring students who are struggling with the basics in C++

I am tutoring a few students who are having significant trouble learning the basics of their first programming language: C++. I have known many excellent and bright students who have failed or dropped ...
8
votes
4answers
5k views

Fast algorithm to search a sorted array of floats to find the pair of floats bracketing an input value

I have an array of floats, sorted from smallest to largest, and need to be able to pick out the nearest float greater than or less than a passed input value. This input value is not necessarily ...
7
votes
4answers
550 views

“Pythonic” equivalent term for code written in modern C++ style? [closed]

There's a lot of good idioms promoted in modern C++. These include RAII and elegant use of boost or STL or a std::algorithm to solve a given problem. Just like you can write C in any language, you ...
1
vote
4answers
537 views

Why python library APIs are more intutive than C++ STL library APIs? [closed]

I am not sure whether it is a personal perspective or just a common feeling. I think in most cases, python's API is much more intuitive than C++ STL library APIs. If it is not a subjective ...
0
votes
1answer
323 views

Using MVP, how to create a view from another view, linked with the same model object

Background We use the Model-View-Presenter design pattern along with the abstract factory pattern and the "signal/slot" pattern in our application, to fullfill 2 main requirements Enhance ...
3
votes
5answers
524 views

Designing for an algorithm that reports progress

I have an iterative algorithm and I want to print the progress. However, I may also want it not to print any information, or to print it in a different way, or do other logic. In an object oriented ...
7
votes
5answers
3k views

Why do schools (or most schools) teach Java as the intro language? [duplicate]

Possible Duplicate: Why do we study Java at university? This is a question I've wondered a lot as a young developer that just graduated from college. Why do schools teach Java in-depth vs ...
3
votes
3answers
1k views

What is a good workflow for a C++ beginner?

I desire to become a more serious scientific C++ programmer. To do so, I need a consistent style of workflow (e.g., coding, test-driven development, etc.). My question is simply what sort of ...
45
votes
16answers
3k views

Strictness in programming methods among Stack Overflow users [closed]

I've been a member of Stack Overflow for a couple of weeks now and have answered questions and read others answers, mostly in C/C++. True, I have learned about some things. For example, undefined ...
18
votes
5answers
1k views

Why C++ cannot adopt D's approach for its concept implementation?

As many of you guys know, concepts, C++'s approach for constraining possible types for a template argument has failed to be included in C++11. I learned that the D programming language 2.0 has a ...
3
votes
3answers
457 views

Reasons for C++ Prototyping

I'm a beginning programmer, trying to get a grasp on everything, so pardon the probably mundane theoretical question: I see in a C++ tutorial that prototyping is needed to let the compiler know that ...
3
votes
7answers
769 views

Pass in single settings object vs multiple setter methods?

Working with C++. Suppose I have a class BoxFilter. The class is used to filter boxes which have properties such as height, width, depth, weight, etc. The filter might have something like MaxWidth ...
6
votes
8answers
2k views

C++ to friend or not to friend

I have an object oriented programming with c++ course this semester at college and we were learning about friend functions. I instinctively dislike them for their ability to bypass the security that ...
4
votes
2answers
522 views

Is there a term for the error-handling anti-pattern of discarding all available info and just returning failure?

From time to time (unfortunately way too often) I have to fix code such as this: // C++ code bool anyOldFunction(Param p) { try { ... if(some_condition_here) { handleErrorX(); return ...
4
votes
3answers
3k views

Macbook pro for a C++ programmer? [closed]

I am a computer science student and I'm thinking of getting a new laptop. Is Macbook C++ programmer friendly? Does OSX have enough tools as in Linux for programming. Does working on a macbook hinter ...
5
votes
4answers
678 views

Why were concepts (generic programming) conceived when we already had classes and interfaces?

Also on stackoverflow.com: I understand that STL concepts had to exist, and that it would be silly to call them "classes" or "interfaces" when in fact they're only documented (human) concepts and ...
1
vote
8answers
2k views

Should I choose C or C++ for an interview?

I know a bit of both C and C++. I am assuming that many people who know C++ also know C. I am wondering what language I should pick to code in during an interview. C, because it's faster to make a ...
32
votes
2answers
2k views

How should C++ Unit Test code be organized for maximum Unit Test efficiency?

This question is not about Unit Testing Frameworks. This question is not about writing Unit Tests. This question is about where to put the UT code written and how/when/where to compile and run it. ...
6
votes
12answers
1k views

Language Choice for Algorithm Competitions [duplicate]

Hi everyone I have just started taking part in online coding competitions.I would like to know which language would be better as regards efficiency and ease of debugging. I tend to avoid c++ and ...
2
votes
3answers
2k views

Learning MFC: Pre-2010 vs 2010 and beyond [closed]

First, some background: I've been programming for about 12 years now. I am intermediate to advance in C# and a couple other managed languages, but never messed with anything native. I understand ...
24
votes
0answers
2k views

What are the advantages of the Intel C++ compiler? [duplicate]

What are the advantages over the Intel C++ Compiler over the (much cheaper) free alternatives, such as gcc?