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

learn more… | top users | synonyms

2
votes
3answers
3k views

Functions returning pointers

C++ noob here. I have a very basic question about a construct I found in the C++ book I am reading. // class declaration class CStr { char sData[256]; public: char* get(void); }; // ...
11
votes
8answers
1k views

Does low latency code sometimes have to be “ugly”?

(This is mainly aimed at those who have specific knowledge of low latency systems, to avoid people just answering with unsubstantiated opinions). Do you feel there is a trade-off between writing ...
8
votes
4answers
899 views

Java style classes in c++

I came across this article proposing a style of coding in c++ that looks a bit weird at first. But after reading it over and pondering for a bit I'm really considering giving it a try. The most ...
16
votes
5answers
3k views

Why don't modern libraries use OOP

I'm a beginner-level C++ programmer, but I understand the concepts of the language fairly well. When I began to learn external C++ libraries, like SDL, OpenGL (maybe something else too), to my great ...
3
votes
1answer
1k views

C++ Design: Functional Programming vs OOP

Design Question Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some ...
8
votes
8answers
1k views

How important is it to learn makefiles? [closed]

I work in c++ mostly as a hobby (I'm still in school and therefor don't have a real job). The IDEs generate the makefile for me and so I'm wondering if it's worth learning how to make them myself. By ...
0
votes
1answer
269 views

Scientific software design [closed]

I asked this question over at stackoverflow and it was suggested a tighter form be posted here. Many early career numerical researchers face the prospect of having to create performance critical ...
3
votes
1answer
475 views

Encapsulate bitmap (*.bmp) as C++ class

How would you implement / design a class which has to represent a bitmap? I'm stuck at handling the different possible color modes and I keep thinking that this should be somehow implementable using ...
2
votes
1answer
171 views

How can I move a library inside a project's source tree and compiling static binaries?

How can I move a library inside a project's source tree and compiling static binaries? I want to use a particular tool that utilizes ANCIENT binaries without upgrading it's API usage. This way I can ...
9
votes
2answers
744 views

Refactoring several huge C++ classes / methods. How to start? [duplicate]

Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? I'm dealing with legacy code. It contains some BIG classes (line count 8000+) and some BIG methods (line count ...
1
vote
1answer
67 views

Term for a single C++ endpoint/object file

I have heard several terms for a C++ "Codepoint" (which is what I've heard used the most often), or a .cpp file that is compiled into an object file. For instance, .cpp files can include other .cpp ...
3
votes
3answers
309 views

is Microsoft LC random generator patented?

I need a very simple pseudo random generator (no any specific quality requirements) and I found Microsoft's variant of LCG algorithm used for rand() C runtime library function fit my needs (gcc's one ...
2
votes
3answers
1k views

C++ Pointers: Number of levels of Indirection

In a C++ program that doesn't contain legacy C code, is there a guideline regarding the maximum number of levels of indirection that should be used in the source code? I know that in C (as opposed to ...
2
votes
1answer
637 views

Is there an open source version check library and web app?

I'm a developer for a cross platform (Win, MacOS, Linux) open source C++ application. I would like to have the program occasionally check for the latest version from our web site. Between the ...
-1
votes
1answer
499 views

Benefit of C++ to System Administrators [closed]

What benefit could C++ bring to system administrators? I am working on Windows and Ubuntu. If I learn C++, where could I implement it in system administration, Please specify some of its benefits.
2
votes
2answers
8k views

Is Intellisense faster in Visual Studio 2012 compared to Visual Studio 2010 for C++ projects? [closed]

We switched to VS2010 from VS2003 a few months ago, and there are many many improvements. But the speed of Intellisense is not one of them (although it does generate higher quality results, which is ...
-1
votes
2answers
717 views

What are the ways to start making actual/real-world programs using Java/C++ to excel my Programming Skills? [duplicate]

Possible Duplicate: How do I improve my coding skills? How I do become a better programmer as a junior developer The programming that we learn at university is not that vast, like those ...
2
votes
2answers
104 views

share code between check and process methods

My job is to refactor an old library for GIS vector data processing. The main class encapsulates a collection of building outlines, and offers different methods for checking data consistency. Those ...
10
votes
2answers
968 views

Why is using C++ libraries so complicated?

First of all, I want to note I love C++ and I'm one of those people who thinks it is easier to code in C++ than Java. Except for one tiny thing: libraries. In Java you can simply add some jar to the ...
0
votes
5answers
459 views

should singleton be life-time available or should it be destroyable?

Should the singleton be designed so that it can be created and destroyed at any time in program or should it be created so that it is available in life-time of program. Which one is best practice? ...
2
votes
4answers
2k views

Should I use C style in C++?

As I've been developing my position on how software should be developed at the company I work for, I've come to a certain conclusion that I'm not entirely sure of. It seems to me that if you are ...
18
votes
3answers
17k views

what is message passing in OO?

I've been studying OO programming, primarily in C++, C# and Java. I thought I had a good grasp on it with my understanding of encapsulation, inheritance and polymorphism (as well as reading a lot of ...
2
votes
7answers
1k views

Is there a quick and practical (hands on) way to learn another programming language?

Due to rather strange circumstances, I only have until Monday to learn (at least) the basics of PHP and .NET programming. I'm already fairly competent (though there is a lot of room for improvement) ...
0
votes
2answers
331 views

What kind of specific projects can I do to master bitwise operations in C++? Also is there a canonical book? [closed]

I don't use C++ or bitwise operations at my current job but I'm thinking of applying to companies where it is a requirement to be fluent with them (on their tests anyway). So my question is: Can ...
2
votes
2answers
115 views

Order of executions in C++ streams

It is obvious that first cout prints 7 7 but why the second one prints 8 8 7 ? Why not 7 8 8? How does such constructions work in c++? int ink(int *x){ *x += 1; return *x; } int main(){ ...
5
votes
3answers
807 views

Tension between the dependency inversion principle and avoiding “new” in C++?

I have seen a lot of advice that it is better to do Type object; than Type* object = new Type(); in C++ whenever possible—i.e., minimize your use of new. I understand the rational behind this and ...
23
votes
2answers
10k views

Will C# merge with native C++ compiler? [closed]

According to this post : http://channel9.msdn.com/Forums/Coffeehouse/MS-working-on-a-same-compiler-for-C-AND-C--Not-in-incubation-but-for-production- How much truth is in this post? Should it be ...
1
vote
1answer
334 views

Where does the “mm” come from in GTKmm, glibmm, etc

I understand that the "mm" suffix [in various GTK-associated C++ binding libraries] means "minus minus," but where exactly does it come from? I understand that there is a programming language called ...
-1
votes
1answer
519 views

How to move a car around an environment with hills in C++?

I don't have any code for this since I don't know how I am meant to do this. I have a car and I am able to move it around on a flat plane and I have that working correctly. However, I want it to also ...
0
votes
1answer
717 views
0
votes
1answer
276 views

What are some books that explain low level stuff like com interfaces, dll injection etc? [closed]

What are some books that explain low level stuff like com interfaces, dll injection etc? Basically low level windows programming. Searching on amazon gives me hacking books/10+ year old books which is ...
3
votes
2answers
466 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). ...
-1
votes
1answer
981 views

C++ job interview questions? [closed]

I am expecting a job interview for a C++, what kind of questions should I expect? I have been programming with C for 5 years. I know what OOP is and I have been reading about it for some time. But ...
8
votes
2answers
2k views

is there anything else like WPF can run in Linux and Mac

I am looking for anything else has the same WPF functionality (animation, 3D,...) but can work in other platforms (Linux, Mac,...) something powerful, fast to develop with, can create my own custom ...
3
votes
1answer
500 views

Brief material on C++ object-lifetime management and on passing and returning values/references [closed]

I was wondering if anybody can point to a post, pdf, or excerpt of a book containing the rules for C++ variable life-times and best practices for passing and returning function parameters. Things like ...
3
votes
2answers
718 views

Lazy Processing of Streams

I have the following problem scenario: I have a text file and I have to read it and split it into lines. Some lines might need to be dropped (according to criteria that are not fixed). The lines ...
1
vote
2answers
283 views

What is a useful pattern to maintaining an object state in a one to many relationship?

I am looking for a design for my application, here are the players(classes) involved. struct Transform { // Uses a matrix to transform the position. // Also acts acts as the state of a ...
2
votes
1answer
329 views

Brief explanation for executables in a GNU/Clang Toolchain?

I roughly understand that cc, ld and other parts are called in a certain sequence according to schemes like Makefiles etc. Some of those commands are used to generate those configs and Makefiles. And ...
6
votes
2answers
257 views

What would be a non-contrived reason to have an object with Private Copy Constructor as well as Assignment Operator?

Looking for non-conceptual/non-contrived reasons of when one would need to use an object with both a private copy constructor and a private assignment operator? As in what problem does this ...
5
votes
7answers
2k views

Programming Interview : How to debug a program?

I was recently asked the following question in an interview : How do you debug a C++ program ? I started by explaining that programs may have syntax and semantic errors. Compiler reports the ...
1
vote
3answers
280 views

Programming C++ using Qt4 [closed]

Hey guys I am really new to the C++ programing I have a little knowledge in C and a bit more in C++, but I do not know them enough to call myself a programmer. I am working as a PHP Web Developer I ...
3
votes
2answers
334 views

Clarification on the Strategy Pattern

I've just been reading through some basic design patterns, Could someone tell me if the term "strategy pattern" only applies if your implementing a completely abstract interface? What about when ...
1
vote
1answer
548 views

How can you become a real programming polyglot? [closed]

I work as a Java programmer, but C and C++ were always my favourite languages during studies. Unfortunatelly I don't have an opportunity to work with them as often as I would like to. As a result I ...
11
votes
7answers
1k views

In C and C++, what methods can prevent accidental use of the assignment(=) where equivalence(==) is needed?

In C and C++, it is very easy to write the following code with a serious error. char responseChar = getchar(); int confirmExit = 'y' == tolower(responseChar); if (confirmExit = 1) { exit(0); } ...
3
votes
5answers
399 views

Does comparison operand order affect speed?

I notice that someone in my organization programs comparisons like: if (100 == myVariable) rather than: if (myVariable == 100) He claims the former is quicker in languages like C++. I can't ...
7
votes
9answers
1k views

What is the way to understand someone else's giant uncommented spaghetti code? [duplicate]

Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? I have been recently handled a giant multithreaded program with no comments and have been asked to understand ...
12
votes
4answers
698 views

Co-worker uses ridiculous commenting convention, how to cope? [closed]

A co-worker in the small start-up I work at writes (C++) code like this: // some class class SomeClass { // c'tor SomeClass(); // d'tor ~SomeClass(); // some function void ...
3
votes
1answer
591 views

combining ruby and C++

I've been discussing a conceptual project with a friend of mine and the the most effective way we've seen of doing it is writing the engine in C++ while the logic would be done in Ruby. However, we ...
2
votes
2answers
226 views

Which numeral systems are useful in computer science?

I am wondering which numeral system different programmers are using, or would use if their language has support for them. As an example, in C++ we can use: Octal by prefixing with 0 (e.g. 0377) ...
8
votes
4answers
3k views

Is it important to know C/C++ for Android development?

Is it possible to use only Java (without C++ /NDK) for building good, fast, beautiful Android apps (including 3D development)? When I look for Android developer position requirements (vacancies), I ...