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

learn more… | top users | synonyms

9
votes
5answers
2k views

How do you pronounce the '…' operator [closed]

Now, in c++ '...' became a first class operator. In speech, how do you pronounce it? So far I've heard: dot dot dot triple dot ellipsis related: Is it OK to replace ... with ellipsis in writing? ...
2
votes
1answer
350 views

Can Win32 message loops survive being ported to native linux?

I would like to port a large Win32 DLL to native linux in C++. I don't think I can use Wine for a DLL like mine, because users of the DLL would then also have to be in Wine, and then they would all ...
4
votes
1answer
988 views

Best Creational Pattern for loggers in a multi-threaded system?

This is a follow up question on my past questions : Concurrency pattern of logger in multithreaded application As suggested by others, I am putting this question separately. As the learning from ...
3
votes
3answers
484 views

design for a parser to handle very large files

I have written a program which records protocol messages between an application and a hardware device which matches each application request with each hardware response. This is so that I can later ...
8
votes
2answers
755 views

The C++ web stack, is there one?

Java would be jsps and servlets (or a framework such as Spring) running on the JVM and tomcat (or glassfish etc). C# would be asp and C# running on dot.net framework and IIS ? (I have no experience ...
3
votes
1answer
671 views

What are the differences between Special Edition and the Third Edition of Stroustrup's The C++ Programming Language?

I'm buying a few C++ books after moving from Java. I obviously want to read the reference manual from the man himself, though I cannot tell the difference between these two editions. The special ...
16
votes
5answers
1k views

Why am I seeing so many instantiable classes without state?

I'm seeing a lot of instantiable classes in the C++ and Java world that don't have any state. I really can't figure out why people do that, they could just use a namespace with free functions in C++, ...
5
votes
2answers
271 views

Data structures for storing finger/stylus movements in drawing application?

I have a general question about creating a drawing application, the language could be C++ or ObjectiveC with OpenGL. I would like to hear what are the best methods and practices for storing strokes ...
2
votes
2answers
2k views

Passing variables from PHP to C++

I need to call a program from PHP and pass some vars and/or sets of key-value pairs to it. How do I pass these vars, through arguments to the called function? exec("/path/to/program flag1 flag2 ...
2
votes
1answer
1k views

3d point cloud render from x,y,z 2d array with texture

Need some direction on 3d point cloud display using OpenGL in c++ (vs2008). I am brand new to OpenGL and trying to do a 3d point cloud display with a texture. I have 3 2D arrays (each same size ...
2
votes
3answers
4k 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); }; // ...
8
votes
3answers
947 views

How to calculate Sin function quicker and more precisely?

I want to calculate y(n)=32677Sin(45/1024•n), where y is an integer and n ranges from 0 to 2048. How can I make this process quicker and more precisely? Now I want to show you a reference answer: ...
2
votes
4answers
705 views

what are some good interview questions for a position that consists of reviewing code for security vulnerabilities?

The position is an entry-level position that consists of reading C++ code and identifying lines of code that are vulnerable to buffer overflows, out-of-bounds reads, uncontrolled format strings, and a ...
6
votes
1answer
163 views

Unit testing a text index

Consider a text index such as a suffix tree or a suffix array supporting Count queries (number of occurrences of a pattern) and Locate queries (the positions of all the occurrences of a pattern) over ...
5
votes
2answers
834 views

Efficient Data Structure for holding a graph

Problem Link - http://opc.iarcs.org.in/index.php/problems/NUMTRIPLE In my opinion, the problem can be solved by a data structure, that shows how each number is connected to another, and via recursion ...
4
votes
1answer
1k views

How to implement child-parent aggregation link in C++?

Suppose that I have three classes P, C1, C2, composition (strong aggregation) relations between P <>- C1 and P <>- C2, i.e. every instance of P contains an instance of C1 and an instance ...
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 ...
11
votes
2answers
412 views

FP for simulation and modelling

I'm about to start a simulation/modelling project. I already know that OOP is used for this kind of projects. However, studying Haskell made me consider using the FP paradigm for modelling a system of ...
3
votes
3answers
2k views

How to setup the c++ rule of three in a virtual base class

I am trying to create a pure virtual base class (or simulated pure virtual) my goal: User can't create instances of BaseClass. Derived classes have to implement default constructor, copy ...
0
votes
3answers
678 views

Reconstruct a file from a TCP stream

I have a client and a server and a third box which sees all packets from the server to the client (but not the other way around). Now when the client requests a file from the server (over HTTP), the ...
3
votes
1answer
623 views

How are crossplatform/multiple-OS C++ projects planned in terms of code and tools?

I want to create a project in C++ that can work in Windows, Linux and Embedded Linux. How are projects created when they have to work across many OS'es? Is it first created on one OS and then the ...
1
vote
3answers
612 views

Common header file for C++ and JavaScipt

I have an app that runs a C++ server backend and Javascript on the client. I would like to define certain strings once only, for both pieces of code. For example, I might have a CSS class ...
2
votes
1answer
5k views

Most efficient Implementation a Tree in C++

I need to write a tree where each element may have any number of child elements, and because of this each branch of the tree may have any length. The tree is only going to receive elements at first ...
3
votes
5answers
413 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 ...
0
votes
2answers
232 views

Visual C++, CMap object save to blob column

I have a MFC CMap object, each object stores 160K~ entries of long data. I need to store it on Oracle SQL. We decided to save it as a blob. Since we do not want to make additional table, we also ...
3
votes
1answer
156 views

Using T[1] instead of T for functions overloaded for T(&)[N]

The asio::buffer function has (void*, size_t) and (PodType(&)[N]) overloads. I didn't want to write ugly C-style (&x, sizeof(x)) code, so I wrote this: SomePacket packet[1]; // SomePacket is ...
8
votes
7answers
323 views

How does a variable introduce state?

I was reading the "C++ Coding Standards" and this line was there: Variables introduce state, and you should have to deal with as little state as possible, with lifetimes as short as possible. ...
4
votes
1answer
1k views

JavaFX 2.0 vs Qt for cross platform stand-alone application [closed]

I need a bit of advice from you developers who deal with cross-platform applications (specifically programs with a GUI). I will be creating an application soon that needs to be cross-platform and so ...
9
votes
4answers
1k views

What is use of universal character names in identifiers in C++

The C++ standard (I noticed it in the new one, but it did already exist in C++03) specifies universal character names, written as \uNNNN and \UNNNNNNNN and representing the characters with unicode ...
2
votes
1answer
900 views

Serializing network messages

I am writing a network wrapper around boost::asio and was wondering what is a good and simple way to serialize my messages. I have a message factory which can take care of dispatching the data to the ...
85
votes
13answers
8k views

Way in over my head! (Dealing with better programmers)

I've just been hired as a member of a group that is developing in C++. For the last 11 years, I'd been coding on and off at my last job (some C, some Fortran, some C++). The coding I'd done was ...
7
votes
3answers
11k views

Cross-platform desktop programming: C++ vs. Python [closed]

Alright, to start off, I have experience as an amateur Obj-C/Cocoa and Ruby w/Rails programmer. These are great, but they aren't really helpful for writing cross-platform applications (hopefully ...
2
votes
1answer
420 views

Resolving equivalence relations

I am writing a function to label the connected component in an image (I know there are several libraries outside, I just wanted to play with the algorithm). To do this I label the connected regions ...
1
vote
1answer
422 views

Linking application build number to svn revision

I am looking for a strategy to version an application with the following requirements. My requirements are given an exe with version number (major.minor.build-number) 1) I want to map the version to ...
2
votes
3answers
2k views

When is using stdio preferable to fstream?

I work on a well-established, embedded C++ code base. We have been using a proprietary API to our filesystem. For better integration with third-party C libraries, we are currently in the process of ...
2
votes
6answers
1k views

Can I get a C++ Compiler to instantiate objects at compile time

I am writing some code that has a very large number of reasonably simple objects and I would like them the be created at compile time. I would think that a compiler would be able to do this, but I ...
2
votes
3answers
819 views

Does using a wrapper class for pointers make sense?

In C++, pointers generally have a lot more functionality associated with them than is really necessary. A class template that wraps a pointer and removes most of the less-used features (arithmetic, ...
6
votes
2answers
2k views

What to learn after standard C++? [closed]

I switched to C++ a few months ago, learning its syntax, the main features of the STL and what you can usually find in a "learn C++" manual. Now I would like to go further. What would be your ...
3
votes
1answer
190 views

Parallel Threading in Multi-Language Software?

I'm developing a software that contain many modules/Daemon running in parallel manner, what i'm looking for is how to implement that, i cannot use Thread because some of those modules/Daemon are ...
1
vote
1answer
962 views

How can I implement a database TableView like thing in C++?

How can I implement a TableView like thing in C++? I want to emulating a tiny relation database like thing in C++. I have data tables, and I want to transform it somehow, so I need a TableView like ...
7
votes
3answers
3k views

Data classes: getters and setters or different method design

I've been trying to design an interface for a data class I'm writing. This class stores styles for characters, for example whether the character is bold, italic or underlined. But also the font-size ...
5
votes
4answers
1k views

Maintaining C/C++/Java skills as a web developer

When I was in college I learned how to program in C, C++, and Java. Currently, I'm a web developer using front end and back end technologies (HTML/CSS/JS, PHP, MYSQL). While the sorting algorithms and ...
9
votes
4answers
2k views

Are there any conceptual drawbacks to building a web app with C++ and MySQL?

I've inherited a pretty interesting project where there is a good opportunity to take an existing piece of software and turn it into a SaaS web app. As the project is inherited, the code base/ ...
3
votes
4answers
2k views

Is using a bigger buffer useful?

I use buffer for quite a long time when I need to copy a stream or read a file. And every time I set my buffer size to 2048 or 1024, but from my point of view a buffer is like a "bucket" which ...
5
votes
3answers
8k views

Efficient way to find unique elements in a vector compared against multiple vectors

I am trying find the number of unique elements in a vector compared against multiple vectors using C++. The vectors are in sorted order and it can be of size 2,000,000. Suppose I have, v1: 5, 8, 13, ...
5
votes
5answers
2k views

What's so bad about pointers in C++?

To continue the discussion in Why are pointers not recommended when coding with C++ Suppose you have a class that encapsulates objects which need some initialisation to be valid - like a network ...
3
votes
2answers
3k views

C++ Library API Design

I'm looking for a good resource for learning about good API design for C++ libraries, looking at shared objects/dlls etc. There are many resources on writing nice APIs, nice classes, templates and so ...
8
votes
6answers
1k views

Is it OK to mix C and C++ in an interview?

If I am asked in an interview to write down some code, should I completely stick with C++ or is it acceptable to "mix" the two to write easy code as it comes to my mind? I'll explain it: if I'm asked ...
2
votes
2answers
422 views

How to translate formulas into form of natural language?

I am recently working on a project aiming at evaluating whether an android app crashes or not. The evaluation process is 1.Collect the logs(which record the execution process of an app). ...
0
votes
5answers
1k views

Learning basic algorithms - better C or C++? [closed]

I'm studying fundamental algorithms (quicksort, mergesort, binary trees, etc..) and I'm going to re-code every algorithm by scratch to learn how they work. Should I code them in C or C++? I think with ...