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

learn more… | top users | synonyms

-3
votes
0answers
41 views

Best book to learn OOP in Java if you know C/C++ at beginner level? [on hold]

Which is the Best book to learn OOP in Java if you know C/C++ at beginner level? Or What is the best way to learn JAVA and OOP in case one knows C/C++?
-2
votes
2answers
209 views

How comes the C++ standards committee introduces a keyword like nullptr and gets away with it? [on hold]

That must have broken a lot of peoples code bases right? Everyone who had a variable named "nullptr" (which I think would have been fairly common) has to find "nullptr" and replace with ...
0
votes
0answers
11 views

How can I pass floating point numbers as template parameters? [migrated]

I am working on a meta-programming project, and we would like to have the ability to pass floating-point numbers as template arguments. I wasn't sure whether this question would be better suited to ...
-2
votes
1answer
118 views

C++ certifications [on hold]

What are the most respectable C++ certifications? How do they relate to each other? For now I am aware only of the CPPGM and Brainbench.
2
votes
2answers
90 views

Potentially justifiable use case for const_cast or bad design?

I'm designing a data structure in C++, and I want to expose an interface to the user to traverse the structure in some order. Instead of creating several different types of enumerators, I want to keep ...
0
votes
0answers
50 views

Dynamic programming in Bin packing

Problem: Given a list L of objects of possible sizes from set S={1,2,4,8} and unlimited supply of bins of sizes 16 each and we have to use minimum possible numbers of bins to pack all objects of L. I ...
0
votes
0answers
44 views

Making Games With C++ [on hold]

Hey Is It Possible To Make A Game With C++ ? For Example An RTS 3D Game Or First Person Shooter. If Not Can It At Least Compile Files To Be Used In The Game Scripting?
0
votes
0answers
25 views

Infix to postfix using recursion [on hold]

I have written a C++ program to convert an infix expression to postfix expression using recursion. I would like to know if it can be improved if possible. Can we improve it by not using stack? I am ...
-3
votes
0answers
31 views

C++ Streaming Audio Files [on hold]

How To Use C++ To Play .mp3 .mp4 Music Files Like I Want To Write A Script Thats Makes My Program Play A Sound/Music File From My Computer Or From The Internet Where I Can Just Type A Line Like This ...
-1
votes
0answers
20 views

.Net profiler MSDN example - Spyder.dll not working [on hold]

As a first step to start with my .Net profiler development, I downloaded a sample .NET profiling project from msdn link below, http://msdn.microsoft.com/en-us/magazine/cc188693.aspx I followed the ...
0
votes
2answers
92 views

Standalone C++ Application With Integrated CGI [on hold]

I'm not sure if I'm over thinking this, but I seem to have a unique problem based on my Google results. I have an embedded Linux device that has a standalone C++ application. I am wondering if there ...
-1
votes
1answer
39 views

Command Recognition Program Gets Messed Up [on hold]

I am writing a command recognition program that runs in Terminal. First it asks you for your name, like it is supposed to, but then it fails. If I enter hi, it says Leaving so soon, Daniel but I wrote ...
2
votes
1answer
76 views

OpenGL's relationship to OpenGL ES (3.0)

I'm beginning my journey into graphics programming and want to learn OpenGL. Because I'm green to graphics programming but not to C and C++, a familiar question came up when I looked at OpenGL and ...
0
votes
3answers
257 views

Is there still any value in learning assembly languages today? [closed]

Specifically for a game programmer. If you really needed some assembly routines you could look for help, whereas back in the 80s/90s it was one of the mainstream languages. I read that compilers can ...
0
votes
0answers
41 views

Best resource for learning data structures using c++? [closed]

What are the best resources to master the language as well as the best part of programming, the data structures?
1
vote
1answer
471 views

Why is C++ “this” poorly designed?

1) For every a and b which are non-const pointers of the same type, you can do a = b;, right? 2) Inside non-const member functions the this keyword exists, which is a non-const pointer. So logicaly ...
0
votes
0answers
115 views

Implementing a simple equivalent of create table using c++ [closed]

I wrote a bus ticket reservation system, in c. The admin could add buses, and number of seats, then for each bus, the admin could book seats with using the user details, cancel reservation. Adding a ...
2
votes
1answer
129 views

Is it poor form to use C features such as the size_t type instead of their c++, such as std::size_t?

I have recently been told that using size_t as declared in the global namespace is incorrect in C++, ostensibly because size_t is a C-feature. I looked this up and came across this question on Stack ...
1
vote
0answers
50 views

Simulation of a point mass in a box (3D space) [migrated]

I would like to simulate a point mass within a closed box. There is no friction and the point mass obeys the impact law. So there are only elastic collisions with the walls of the box. The output of ...
-9
votes
0answers
50 views

High-level programming and event driven languages [closed]

What are the advantages and disadvantages of high-level programming and event driven programming?
18
votes
5answers
6k views

Is it a good idea to “#define me (*this)”?

This macro can be defined in some global header, or better, as a compiler command line parameter: #define me (*this) And some usage example: some_header.h: inline void Update() { /* ... */ } ...
0
votes
1answer
67 views

Microsoft Visual C++ Redistributables, Software Requirement? [closed]

When compiling with Visual Studio C++, I noticed that you need a specific MSV C++ Redist, depending on the version of Visual Studio you compile with. The required redistributable is necessary on ...
0
votes
0answers
44 views

Web Services of System Integration

I have been assigned to a system integration project. However, I do not understand part of the integration implementation architecture. For example, I have a passport scanner connected to a Windows ...
0
votes
0answers
53 views

Memory management scheme for custom memory allocator

I am in the process of implementing a small memory manager. The users of this memory pool will always access the memory bytes via handles. So a memory allocation/deallocation is done with two APIs: ...
0
votes
0answers
75 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 ...
0
votes
2answers
151 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 ...
2
votes
1answer
52 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 ...
0
votes
1answer
63 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 ...
5
votes
2answers
493 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 ...
3
votes
1answer
328 views

Why do programmers still use “SAFE_DELETE”? [closed]

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 ...
-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 ...
0
votes
3answers
222 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) { ...
17
votes
4answers
540 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 ...
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 ...
3
votes
3answers
197 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> ...
-3
votes
1answer
113 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
147 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
128 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 ...
1
vote
4answers
591 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, ...
0
votes
1answer
70 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 ...
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
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 ...
2
votes
2answers
248 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 ...
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?
1
vote
3answers
82 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 ...
2
votes
3answers
244 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
129 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
338 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
143 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 ...
6
votes
4answers
447 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. ...