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

learn more… | top users | synonyms

8
votes
4answers
6k 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 ...
28
votes
13answers
3k 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 ...
1
vote
4answers
573 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 ...
7
votes
5answers
4k 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 ...
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 ...
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 ...
53
votes
17answers
5k views

What programming problems are best solved by using pointers?

Well, I basically understand how to use pointers, but not how best to use them in order to do better programming. What are good projects or problems to resolve involving the use of pointers so I can ...
5
votes
3answers
843 views

Young C++ student lacking direction

I was hoping for some direction or guidance regarding my C++ learning experience. I have now read two books, from cover to cover, twice. The first was Ivor Horton's Beginning Visual C++ 2010 and ...
3
votes
3answers
467 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 ...
32
votes
10answers
3k views

Difference between Idiom and Design Pattern?

What is the difference between idiom and design-pattern? It seems that these terminologies overlap somewhere; where exactly, I don't know. Are they interchangeable? When should I use what? Here is a ...
3
votes
7answers
829 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 ...
4
votes
2answers
550 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
4answers
2k views

Do I need to understand pointers to use C++?

Well, I love C++, I have been using it for a while: I like all the libraries (Allegro, SDL, QT, Ogre, etc.), but I have a problem: I don't understand pointers. Do I really need them ? I just program ...
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 ...
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 ...
5
votes
4answers
723 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 ...
30
votes
3answers
9k views

How could the first C++ compiler be written in C++?

Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ). However, how is it even possible that the first C++ compiler be written in C++? The code that makes up the ...
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. ...
28
votes
6answers
6k 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 ...
6
votes
7answers
1k views

Choosing the type of Index Variables

We use Integer type represent index variables most of the time. But in some situations, we're forced to choose std::vector<int> vec; .... for(int i = 0; i < vec.size(); ++i) .... This ...
2
votes
2answers
891 views

Is there a canonical book on C++/CLI ?

I know quite a lot about C++ but I know very little about .NET. I would like to broaden my horizons. Is there a book out there that's the de-facto standard for describing best practices, design ...
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 ...
5
votes
4answers
676 views

Why do we love using i? [duplicate]

Possible Duplicate: Why do most of us use 'i' as a loop counter variable? Maybe this questions seems to be extreamly stupid but I wonder why we use i as variable in most cases in ...
17
votes
5answers
982 views

Advantages of a left to right language syntax

I've been watching an interview with Herb Sutter on Channel9 and he mentioned at the end of the video that left to right language syntax would be on the top on his whishlist for a future C++ ...
54
votes
11answers
9k views

A modern review of Java [closed]

I've been programming for a few years and I began in Java, and in my time I've found many different sources claiming Java to be an inferior language in some way or another. I'm well aware that each ...
21
votes
4answers
2k views

Given C++ '11 Was Approved, Does This Change How A C++ Beginner Learns The Language?

I've wanted to learn C++ for awhile and took AP Computer Programming in High School (back when it was C++ and not Java). I enjoy C and just haven't found the time to learn C++ or I'll just fall back ...
2
votes
3answers
542 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 ?
6
votes
1answer
2k views

Parallel programming library? (+ some features)

Note: this is a reposting as the question has been considered non-suitable for the Stack Overflow forum and should have been posted here. The original topic is there. I'd like to talk of ...
3
votes
5answers
1k views

function pointers are so complex to me

I found this code sample in this answer by Armen Tsirunyan. class MyClass { public: typedef void (*funcPtr)(int, int); MyClass(funcPtr whatToCall) { callme = whatToCall; } ...
0
votes
2answers
1k views

How do i put my head around ISAPI Filters

I am a newbie. I have decent command over C++ but i lack domain knowledge when it comes to servers and stuff. My current assignment is to write ISAPI filters for IIS Web Server. I have been googling ...
2
votes
3answers
534 views

What are pros and cons of using temporary “references”?

In C and C++ (and I guess other languages that allow taking a "reference" to an array element or something similar), when you have an array like type, accessing individual elements of such an array ...
8
votes
4answers
523 views

What features did c get from c++?

What features were added to C that were originally in C++? When where they added and for what reason(what where the pro/con arguments)? How do they differ in C as compared to C++? Did the features ...
3
votes
3answers
1k views

distribution of programming languages in embedded systems

I am looking for statistics concerning the distribution of programming languages in the embedded sector. Do you know any good websites, articles or books? I found this as a first reference but am ...
18
votes
9answers
1k views

Good design: How much hackyness is acceptable? [duplicate]

Possible Duplicate: Prototyping vs. Clean Code at the early stages I'm right in front of a difficult decision. I have a problem in my codebase (it's in C++), which I could solve in two ...
45
votes
12answers
3k 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 ...
1
vote
3answers
639 views

declaration and definition

People say definition is used when the declared stuff has some memory allocated. If I declare a class class fish { char* name; int type; //someting i dont know about fish }; int main() { ...
8
votes
1answer
3k views

What is “friend” keyword used for?

Can you explain to me why the friend keyword is preferred for giving access rights to private data of class?
5
votes
2answers
2k views

Build automation: Is it usual to use QMake for non-Qt projects?

So, I'm planning to write a C++ library and I want it to be cross-platform, and as this library won't deal with UI and I want it to have as little dependencies as possible, I won't be using Qt ...
13
votes
9answers
733 views

Rewriting IBM assembler + COBOL in C++

I work as a rental agent / manager for a car rental company that is running on a rental system that was written in 1972. I decided that maybe it was time for an update. For a bit of background, here ...
2
votes
1answer
226 views

Database with version history?

I'm developing a game with a component-based architecture. I want to store entity descriptions in a SQLite database for compactness and convenience. Obviously the backend code is (and the database ...
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?
1
vote
2answers
915 views

Design choices when doing multithreading in C++

OK, so, background: I have a little "server" app/module that is written in C++. This is kindof a tunnel application that provides a standardized API via TCP/IP[a] and on the other hand talks to the ...
3
votes
2answers
4k views

xml parser vs JSON parser performance in Java / C / C++

I am trying to understand which data format is better on embedded device communicating with Server over REST API. XML or JSON?. Is JSON parsing faster than XML parsing in Java / C and C++? I ...
3
votes
3answers
992 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 ...
14
votes
5answers
3k views

Can someone explain how a GUI works and when I should start using one? [closed]

I've been learning C++ for about a month now, and before I go any further, I'd like to clear up this tedious question I keep on having. I know what a GUI is, but I don't really know how it works, and ...
1
vote
3answers
148 views

Documentation: What is “appropriate” when expressing a valid range for a parameter?

What is the appropriate method to describe a valid range of a parameter in the documentation of code? Obviously long-form documentation (white papers, API documents, etc) can be more verbose than the ...
3
votes
1answer
6k views

Where to start to learn C/C++ Embedded Linux Programming [closed]

I'm an experienced software engineer and an advanced Linux user. I already know C and C++. I've developed C applications on Unix in the past and C++ (mostly on Windows). I would like to start to ...
16
votes
10answers
3k views

What are the best practices regarding unsigned ints?

I use unsigned ints everywhere, and I'm not sure if I should. This can be from database primary key id columns to counters, etc. If a number should never be negative, then I will always used an ...
14
votes
4answers
4k views

If a variable has getter and setter, should it be public?

I am an about to graduate Computer Science student so probably this is a stupid question. If I have a class with a variable that is private and the class have getter and setter for that variable. Why ...