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

learn more… | top users | synonyms

-2
votes
0answers
25 views

Photoshop/GIMP curves tool - how does it work internally [on hold]

I've been given a task to understand and make a tool similar to Photoshop's/GIMP's curves tools. I'm using c++ with Qt (and can use any library that can be used commercially). I'm a newbie in image ...
0
votes
0answers
29 views

GSP Algorithm explanation

I've been trying to implement the GSC algorithm in C++, however I need help with clarifying the definition: http://en.wikipedia.org/wiki/GSP_Algorithm GSP Algorithm makes multiple database ...
-2
votes
0answers
32 views

Developing Windows Phone and Windows 8 in C++ : Available resources? [on hold]

I've already read that most people suggest that one should develop for Windows / Windows Phone using C#. However, I would like to keep developing in C++, since I use this language for both Windows and ...
0
votes
2answers
131 views

Value of passing by reference [duplicate]

In C++, we have the option to pass by reference or pass by value. The client code does not need to know which one a parent function uses; that is, int func(int param) and int func(int &param) are ...
16
votes
10answers
17k 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 ...
2
votes
1answer
46 views

Python API: Extension Module or Pure Module

We have a C++ application, with C++ interfaces changing regularly during development. We also have a C API which is designed to be stable in spite of such changes; the C API is tighly focused on ...
14
votes
13answers
3k views

Why do operating systems do low level stuff in C and C++? Why not just C++?

On the Wikipedia page for Windows, it states the Windows is written in Assembly for the bootloader and task switcher, and C and C++ for kernel routines. IIRC, you can call C++ functions from an ...
-2
votes
1answer
109 views

Good program to test skills and how to know when I am a competent programmer? [on hold]

I am almost done learning c++ off of learncpp.com I want to know what is a project that I can work on once I am done that will test everything I have learned and allow me to learn what it is like to ...
-5
votes
0answers
53 views

how to learn c++ if you know nothing about programming? [on hold]

I have tried online tutorials and books but I can't find one that is fun or explains without that techy vocabulary, is there any book that is fun or is for beginers that don't know anyting.
-5
votes
0answers
55 views

How to become malware analyst [on hold]

I am willing to be a malware analyst. I am 17 years old and want to be guided. I tried learning x86 assembly form (the art of assembly) but it was complex and I believe that it is very old (I don't ...
4
votes
5answers
1k views

Why no developer API in C++ for Google or Yahoo mail?

I was trying to do some C++ coding that can send files from my laptop to my webmail account. It took me about 10 minutes to realize that there is no easy way to do this. Look into these links: ...
0
votes
1answer
112 views

How to turn a GUI C++ application into distributable executables? [on hold]

Wanting to get into game development, I read a number of questions on this and other sites about saw that one of the popular suggestions was to use SDL in C++. So I worked on this, and I made a few ...
-2
votes
0answers
29 views

Android Application and game development [on hold]

I am really confused what to do! I want to create Games and applications for android in c++. I know I should use android ndk but I don't know how to start with it, And what things do I need. Can ...
4
votes
6answers
6k views

When is C a better choice than C++? [closed]

I can't imagine that there's any reason not to use the OOP features of C++. It's is just as fast as C, and - what's more important to me - it's transparent, just as C. (I mean "transparent" that I ...
0
votes
1answer
51 views

OpenSSL Client model for half duplex communication over socket

I have read in this SO question that OpenSSL socket communication can be only half duplex in a single thread. Assuming what I have read is true, I am wondering if I can apply philosopher's dining ...
-1
votes
1answer
111 views

How to solve linear recurrences involving two functions?

Actually I came across a question in Dynamic Programming where we need to find the number of ways to tile a 2 X N area with tiles of given dimensions.. Here is the problem statement Now after a bit ...
5
votes
2answers
472 views

How do I deal with classes that are only used once, say in only a single function?

I have a class that basically builds up a memory-efficient version of a structure to be used in a performance-critical section of code. The resulting structure is ugly but extremely fast, so not ...
0
votes
0answers
40 views

How does the android JNI work [closed]

I am currently trying to create an iPhone/android app I have chosen to write the model of my program in C++ since it is supported by both platforms. I have been able to compile my C++ source into the ...
1
vote
3answers
179 views

How to manage focus for a small set of simple widgets

I'm developing a set of simple widgets for a small (128x128) display. For example I'd like to have a main screen with an overlay menu which I can use to toggle visibilty of main screen elements. Each ...
1
vote
4answers
570 views

Why would a C executable be smaller when compared to C++ executable

I'm trying to understand why the output file sizes are significantly different when using a C and a C++ compiler. I was writing a small hello world program in C and C++, I noticed that in C version, ...
3
votes
1answer
312 views

Why do programmers still use “SAFE_DELETE”?

If I had a dime for every time I've seen this macro in use, today I would be coding just for fun: #define SAFE_DELETE(p) if ((p) != NULL) { delete (p); (p) = NULL; } Why do programmers insist in ...
2
votes
4answers
1k views

C/C++: Who uses the logical operator macros from iso646.h and why? [closed]

There has been some debate at work about using the merits of using the alternative spellings for C/C++ logical operators in iso646.h: and && and_eq &= bitand & bitor ...
44
votes
7answers
6k views

Why are there so many string classes in the face of std::string?

It seems to me that many bigger C++ libraries end up creating their own string type. In the client code you either have to use the one from the library (QString, CString, fbstring etc., I'm sure ...
3
votes
3answers
188 views

Data Oriented Design - impractical with more than 1-2 structure “members”?

The usual example of Data Oriented Design is with the Ball structure: struct Ball { float Radius; float XYZ[3]; }; and then they make some algorithm that iterates a std::vector<Ball> ...
16
votes
4answers
517 views

How bad is it calling println() often than concatenating strings together and calling it once?

I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an ...
0
votes
3answers
197 views

What does “ (int) value & 0x1, (int) value & 0x2, (int) value & 0x4, (int) value & 0x8 means”

The "value" ranges from 0 to 15 (it's possible values). When will those 4 "if"condition be met? If my (int)value = 2 does this mean 0010? if ((int)value & 0x1) { ...
-1
votes
0answers
39 views

How do I stop characters sent to PuTTY screwing with its title/output? [migrated]

I'm sending JSON to PuTTY on Windows from a C++ program running on an mbed. I've escaped the characters \, /, ", \b, \n, \f, \r, \t as per json.org. But I still have three quirks that I do not ...
-2
votes
0answers
32 views

Cashier function outputs difference results for three very specific cases [closed]

This is my first time posting here, so if the code is too long, I'll be more than happy to edit it. I'm making a cashier, a function that makes change. The odd thing is: If I buy 1.14 for 1.15, I ...
-3
votes
0answers
61 views

High level programming or event driven programming? [closed]

In your opinion, which do you find more effective, event driven programming or high level programming? Please explain your answer simply (I'm not a genius!)
-2
votes
4answers
198 views

Benefits of porting C library to C++ [closed]

Say we take any C library such as libpng or libvorbis and convert it so that it compiles as C++ (only the minimum changes to make it compile as C++ code). Can the compiler do extra optimizations when ...
2
votes
2answers
243 views

What is a good C++ API Design for HW registers?

I am designing an API for a driver that manipulates HW. I have done the following: namespace HWRegister { //private: namespace Data { //accessible only within this namespace ...
2
votes
4answers
1k views

Going through The C Programming Language K&R in Visual Studio

From what I have read, K&R seems to be a good place to start learning programming in general, and C programming specifically. However, I've just started the first chapter and I have a few ...
-1
votes
1answer
104 views

Programmer Analyst vs Software Engineer [closed]

So I've heard the job title "programmer analyst" and "business analyst" thrown around for software jobs recently. How do the responsibilities of Programmer Analysts, Business Analysts and Software ...
17
votes
11answers
6k views

Does C++ compiler remove/optimize useless parentheses?

Will the code int a = ((1 + 2) + 3); // Easy to read run slower than int a = 1 + 2 + 3; // (Barely) Not quite so easy to read or are modern compilers clever enough to remove/optimize "useless" ...
-3
votes
1answer
109 views

C++11 introduction of new programming trends and potential fragmentation of the language [closed]

In my humble opinion, the fact that the C++ language with the introduction of C++11 lives a renaissance is unquestionable. New powerful features were introduced, that give to the programmer advanced ...
2
votes
1answer
139 views

Code re-use in C++, via multiple inheritance or composition? Or…?

I originally asked this question on StackOverflow, but I was directed here, and I think my problem is perhaps as much conceptual as technical, so here goes. If you’re defining a hierarchy of abstract ...
2
votes
2answers
125 views

When does extracting methods from code stop to make sense? [duplicate]

I am currently studying the refactoring methods defined by Marting Fowler (http://refactoring.com/catalog/). He states a tip for replacing chunks of code by a single method that does that job. So ...
0
votes
1answer
62 views

GUI code implementation for specific Window/Form class

Terminology Element/Form Element -> Fields such as text list, combo_boxes, push buttons, etc. Problem I have a program that is basically a fat client that interfaces into a system that keeps track ...
-4
votes
1answer
180 views

High level languages compared with visual programming environments [closed]

Could I have a professional view on the effectiveness of visual block-based programming environments ( a program such as 'blockly' or 'scratch' or 'app inventor') in comparison to high level ...
0
votes
0answers
27 views

C++, namespaces, name lookup on inherited class and Qt [migrated]

I have built Qt5 with the QT_NAMESPACE=Qt_ns option. The following code compiles OK. But why? QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE namespace test_ns { class ...
1
vote
0answers
221 views

Using local variable assigned to return value of a function or using function directly [migrated]

Is there a difference between this: MyClass c = getMyClass(); calculate(c.value); and this: calculate(getMyClass().value); in the scope of performance and memory allocation?
6
votes
4answers
443 views

Split up large interfaces

I'm using a large interface with about 50 methods to access a database. The interface has been written by a colleague of mine. We discussed this: Me: 50 methods is too much. It's a code smell. ...
1
vote
3answers
135 views

How to make a random-access archive of text files?

I wrote an application that tests the performance of evolutionary algorithms. This application performs a run of the algorithm which consists of several generations. The data which is produced by my ...
1
vote
3answers
81 views

Setting global parameters: is this a reasonable use of const_cast and volatile?

I have a program that I run repeatedly with various parameter sets. Different parameters are used in different parts of the program (including different source files). The same parameter may also be ...
1
vote
0answers
69 views

A program to verify ability to read text and understand it [closed]

My little sister still does not read very well - but she keeps playing on computer quite often and she asks me for every little thing she could read herself. It's not that I didn't want to help her, ...
0
votes
3answers
214 views

Application qos involving priority and bandwidth

Our manager wants us to do applicaiton qos which is quite different from the well-known system qos. We have many services of three types, they have priorites, the manager wants to suspend low priority ...
2
votes
3answers
234 views

Transitioning from Java & C to C++

I learned Java and I'm pretty competent programming in it. I also learned C recently. I looked at a comparison between Java and C++ and I like C++'s features like operator overloading and its speed. ...
1
vote
1answer
126 views

Where does `this` go in a x64 thiscall?

So I understand that thiscall doesn't really exist in x64 programming. However, I can't really find any definitive explanation as to where the this pointer is put to be passed to the callee. Is a x64 ...
3
votes
2answers
336 views

Why doesn't C++ allow you to take the address of a constructor?

Is there a specific reason that this would break the language conceptually or a specific reason that this is technically infeasible in some cases? The usage would be with new operator. Edit: I'm ...
1
vote
3answers
142 views

Is storing pointer (of new'd object) in static collection from object constructor a common idiom in C++

In code I am reviewing a common approach I see to storing objects (eg a socket client object), is use a static container to hold the objects. The objects are created by some helper function, eg like ...