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

learn more… | top users | synonyms

2
votes
2answers
328 views

Is Multithreading Appropriate for Setting up Multiple Windows in the Same Application?

I am currently working with a Qt Application which tries to use multi threading to accomplish two task To Prevent the Main Thread's Event Loop from being blocked To increase computation efficiency ...
1
vote
1answer
360 views

what's the most efficient emacs workflow for compilation and interactive execution cycles (C++/makefile)

I try not to cross-post, but the only response I got at stack-exchange was to post here... What's the preferred practice for a compile-run cycle in emacs? Previously, I used alt-x compile (mapped to ...
1
vote
1answer
98 views

Evolutionary behavioural programming resources

A while ago I made Conway's Game of Life. I'd like to make something similar (in C++), where each cell would exhibit behaviours such as: Movement Reproduction Killing of other cells (moving onto ...
1
vote
3answers
93 views

Communicating details of method result?

I have code like this (pseudocode) foreach(Box box in boxes) { if(boxFilter.PassesFilter(box)) { // do something useful } else { Log.Log(format("Box %s was rejected", ...
2
votes
4answers
437 views

Communicating from lower level components to GUI?

What is the recommended way for a lower level software component/module to communicate with the GUI? I'm using C++. I have a service layer class that if some conditions occur needs to notify the ...
14
votes
8answers
2k views

Why is C++ still “hybrid”

On a related question, it has been clarified why C++ is not compatible with C in many aspects. However C++ is still a "hybrid"* language. And unfortunately, many programmers still consider C++ as a "C ...
1
vote
1answer
412 views

Good resources for advanced C++ topics? [closed]

What are some good resources for advanced C++ topics. I know C++, but have little knowledge of threading, advanced meta-programming and inner-workings of meta-programming and I'd like to get better.
5
votes
3answers
395 views

Should a standard include header be specified in each file or as a compiler parameter?

I've got a file such as this: #ifndef STDINCLUDE #define STDINCLUDE #include <memory> #include <stdexcept> #endif I want this file to be included in every header file, because I use ...
3
votes
6answers
3k views

C++, how many years experience? [closed]

As a little background, I've been programming for a long time now using various languages, systems, etc. I've come across the old problem of a recruiter wanting to know "how many years experience" I ...
2
votes
1answer
430 views

Minimal linux distro for compiling arm binaries

I have this setup: A windows/x86 development box and a PandaBoard ES for testing with a linux on it. I would like to ask you for recommending a linux distribution that I would run in Hyper-V on my ...
8
votes
11answers
2k views

Is Object Oriented stuff really that important? [closed]

For years, I have been doing Algorithmic stuff, writing scalable data structures for internet search, for example Randomized Binary Search Trees for Auto Recommendation, BitMaps, Wisdom of Crowd based ...
0
votes
4answers
2k views

Where to use C++ today? [duplicate]

Possible Duplicate: Is there any reason to use C++ instead of C, Perl, Python, etc.? When to use C over C++, and C++ over C? I am going to enter university next fall in computer sciences, ...
1
vote
4answers
2k views

How do I refer to the smallest possible non-zero value?

Back in my C programming days I thought there was a constant or function (I can't remember what it was called, let's call it SMALL) whose value was the smallest possible positive value. (Imagine the ...
-1
votes
2answers
2k views

how can I improve my c++ skills [duplicate]

Possible Duplicate: Why c++? Where to start? I consider myself a java and python coder. For python (usually not so big project but more scripting and fast stuff) I use vim, for java I use ...
8
votes
5answers
2k views

Is having C++ header files without extension a good practice?

I have an argument with a collegue of mine regarding the C++ guidelines to follow. He currently designs all his libraries that way: He uses inconsistently uppercase and lowercase letters in his ...
8
votes
5answers
2k views

Interface and Inheritance: Best of both worlds?

I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required. ...
3
votes
1answer
541 views

Using the decorator pattern in a deep class hierarchy

How would one use the Decorator design pattern for anything other than trivial toy problems, in a deep class hierarchy? For example, let's say you have the class class Decorated : public Foo, Bar, ...
6
votes
2answers
1k views

Best approach to selecting programming languages and 3D graphics API for simulating physics experiments

I am starting a research project and need to nail down a programming language and 3D graphics API where I will be creating an environment in the field of molecular cell biology where I will be ...
12
votes
5answers
7k views

Is it possible to use C++ with the .NET framework?

I've read many comments about GUI programming, in both, C# and C++. And I noticed that Microsoft's .NET framework is powerful for GUI programming. So is it possible to use C++ and .NET framework? I ...
14
votes
6answers
1k views

Is it a good habit to use C expressions in C++ code?

At school we started learning C this year, despite the fact I'm way ahead of class, and I learned Java, C++ and C while the class is at the base of C. Anyhow, I've been documenting myself, reading ...
3
votes
3answers
571 views

Is an 8 second (incremental) build time common?

My current project takes 8 seconds to build one C++ file. Is this common? Other files take 12-15 seconds but most at the moment are about 8 seconds. I use Visual Studio to tell me the time. I have ...
10
votes
4answers
5k views

The term “interface” in C++

Java makes a clear distinction between class and interface. (I believe C# does also, but I have no experience with it). When writing C++ however there is no language enforced distinction between class ...
1
vote
3answers
660 views

How do large-scale applications handle GUI creation?

I'm interested in developing GUI-based Windows applications in C++, but I'm not sure how it's done in professional or large-scale settings. It seems it would take a lot of development time to describe ...
-1
votes
1answer
568 views

How to design classes in right way (sending messages)

Trying to design small project in right way and have a trouble in it:\ about task: need to realize multiplication of big numbers, using fft First, i have classes class LargeNumber{}; class Field{}; ...
5
votes
4answers
16k views

How can I get into C++ graphics library? [closed]

I have been programming for a year so far and I know 2 languages: C and C++. I've covered the basics, I've written functional windows programs, and I've written complicated bits of code. When I was ...
21
votes
5answers
4k views

Is is preferable to design top down or bottom up?

As I understand, top-down design is by refining the abstract high level concept into smaller concrete and comprehensible parts, until the smallest building block is defined. On the other hand, bottom ...
23
votes
7answers
4k views

Are utility classes with nothing but static members an anti-pattern in C++?

The question Where should I put functions that are not related to a class has sparked some debate over whether it makes sense in C++ to combine utility functions in a class or just have them exist as ...
16
votes
3answers
6k views

Where should I put functions that are not related to a class?

I am working on a C++ project where I have a bunch of math functions that I initially wrote to use as part of a class. As I've been writing more code, though, I've realized I need these math functions ...
6
votes
2answers
815 views

What data structure could I use for modeling a network of nodes and edges?

My application needs to model of and perform operations on a network with 40 - 50 nodes and typically less than 6 edges per node. Both nodes and edges are objects with around 1K data each. During ...
2
votes
2answers
309 views

libavcodec/libavformat question

I've seen this code referenced in two different places, yet I haven't seen anybody bring this up, but it seems that on line 00339 there is an empty if block and I just copied the code to compile try ...
0
votes
1answer
185 views

Lua-type Java integration with C++

So I'm curious: I've implemented Lua within C++ a few times before, and while it was relatively simple, it still didn't harness the power that I would have liked. I love how eclipse works, ...
8
votes
4answers
870 views

Exceptions as asserts or as errors?

I'm a professional C programmer and a hobbyist Obj-C programmer (OS X). Recently I've been tempted to expand into C++, because of its very rich syntax. So far coding I haven't dealt much with ...
61
votes
3answers
10k 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 ...
0
votes
7answers
4k views

How to find siblings of a tree?

On my interview for an internship, I was asked following question: On a whiteboard write the simplest algorithm with use of recursion which would take a root of a so called binary tree (so called ...
28
votes
9answers
17k 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 ...
3
votes
1answer
372 views

Multiple source files vs. libraries for a single project

I write a lot of scientific software, and I originally got into programming with F77. I moved to C++ for my primary programming about 10 years ago now, but I do catch myself using F77 habits. One ...
5
votes
3answers
216 views

Is there an efficient way to adapt data from a structure to another in c++?

I'm writing an interface between two configuration models that use different structures. While I know that there is no "magic" way to do the translation from a structure type to another, I wandered if ...
4
votes
2answers
2k views

Should I use friend classes in C++ to allow access to hidden members?

Here is my situation (a simple example). Say I have a class called HiddenData Then I have another class called StoreHiddenData And finaly a class called OperateHiddenData Here's the thing, my ...
27
votes
8answers
11k views

Are C and/or C++ viable/practical options for web development? [duplicate]

I am proficient in C, and I am learning C++ right now. I always played with websites (HTML/CSS), and I was wondering if it would be viable/practical to create some simple web apps using C and/or C++. ...
3
votes
2answers
1k views

Drawing Ellipse from a bounding box?

Does anyone know a good algorithm for drawing an ellipse from a bounding box? draw_ellipse(int s1, int s2, int s3, int s4, color c); I don't need something optimized to incomprehendable , ...
1
vote
4answers
490 views

How should I deal with nested compositions?

I came across the following question on a website for interviews: Here are 3 products: table, chair and bench. Product can be of material: wood, metal, and plastic. Design class structures for ...
11
votes
3answers
736 views

Why didn't the C++ Standard adopt expression templates?

It's my understanding that expression templates as a technique were discovered significantly prior to the original C++ Standard in 1998. Why weren't they used to improve the performance of several ...
10
votes
4answers
557 views

Approaches against code base becoming uniformly slow

We are working on a moderately-sized C++ code base (10Mloc) which through our optimization efforts is becoming uniformly slow. This code base is a set of libraries which we combine to put them to ...
2
votes
1answer
548 views

Confused About Virtual Memory for All Processes

I hope this is the right place. This is a homework assignment for my Operating Systems course and I have to implement a working virtual memory system in C++ so programming is directly involved. I've ...
12
votes
7answers
800 views

After writing code, why do I feel that “I would have written better” after some time? [closed]

I have been working on my hobby project in C++ for more than 2 years. Whenever I write a module/function, I code it with lot of thinking. Now see the problem, do { --> write the code in module ...
20
votes
11answers
5k views

typedefs and #defines

We all have definitely used typedefs and #defines one time or the other. Today while working with them, I started pondering on a thing. Consider the below 2 situations to use int data type with ...
39
votes
8answers
3k views

Can modern OO languages compete with C++'s array store performance?

I just noticed that every modern OO programming language that I am at least somewhat familiar with (which is basically just Java, C# and D) allows covariant arrays. That is, a string array is an ...
11
votes
3answers
1k views

Choose C++ or Java for applications requiring huge amounts of RAM? [closed]

I'm thinking of scientific applications that are mostly processor-bound and heavy on heap usage (at least several gigabytes). Any other time of the year I would happily go with C++, but in this case I ...
1
vote
2answers
1k views

How far is the trail from Java to C / C++? [closed]

I want to find out how easy or hard the transition to C / C++ is for a mid-experienced Java programmer. I've already read the questions about "C++ for Java Programmers" and "Is it necessary for Java ...
6
votes
4answers
2k views

GO instead of C/C++ with cgo

Is it possible to replace C and C++ with Go + cgo and interface frameworks such as Qt or DirectX with Go? Any potential pitfalls I should be aware of? UPDATE: I see that my question was not precise ...