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

learn more… | top users | synonyms

1
vote
5answers
541 views

Is it possible in C++ to define several methods at once?

Sorry for the confusing title of this question, but I can't think of an exact way to word it. I have a very long class with hundreds of similar methods and I am trying to find a way to construct it ...
0
votes
1answer
225 views

Did I answer this correctly and concisely? [closed]

By email I just answered my brother who is learning computer programming that C++ and Java are more similar than C and C++ even though C++ is nearly a superset of C. Do you agree? AFAIK Stanley ...
0
votes
1answer
597 views

Nested classes vs namespaces

Is it good to use nested classes or should I use namespaces instead? In context: I have a templated codec loader and a codec have In objects and Out objects template<class TypeOfData> class ...
-3
votes
1answer
501 views

how to Read in a list of values store it in a queue and change the order of the inputs? [closed]

How to Read in a list of values store it in a queue and change the order of the inputs? For example, read in abc123efgh45678 and display a1b2c3d4e5f6g7h8 I know I can use queue to read in the ...
-2
votes
1answer
4k views

Passing data between two windows forms using visual c++ 2010 [closed]

So, i have a simple forms application : i have a form 1 (Form1.h) and a second form (Form2.h). Form1 consists of a simple Add User button(which at this stage does nothing but opens the form2 and ...
3
votes
3answers
387 views

Is there a way to use a higher level language in a competition that only has C, C++ and Java by default? [closed]

On that competition, you gain access to a system with gcc, vim, emacs and Java. You can't take any file with you and there's no internet access, but you can do whatever you want inside that system. ...
5
votes
2answers
866 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 ...
11
votes
2answers
9k views

Why is C so high in TIOBE index of popularity, while C++ is just under here too, but not as popular? [closed]

I can't get my head around this. If C is so much used, but C is not C++, can someone explain to me the most important reasons that makes C more used than C++ ? Where is all this C code written for ? ...
5
votes
4answers
11k views

Forward declaration vs include

Reduce the number of #include files in header files. It will reduce build times. Instead, put include files in source code files and use forward declarations in header files. I read this in here. ...
8
votes
2answers
751 views

How do I avoid writing lots of pass-through functions in a wrapper?

I have a class, which wraps another class of a common base type. Because the base type interface is quite large this involves writing a lot of pass-through functions. I am looking for a way to avoid ...
11
votes
3answers
5k views

QT-C++ vs Generic C++ and STL [closed]

Been brushing up on my C++ lately, on Ubuntu QQ. I love the Qt framework for everything, especially building GUI's. I became quite familiar with it when using PyQt over the last few years. When ...
1
vote
2answers
2k views

unique_ptr and references - coding style question

I'm pretty sure this is a question purely about aesthetics but I wanted to get all your opinions on it before I start proliferating this type of code in my codebase. Consider the following code: ...
12
votes
4answers
3k views

Why is sizeof called a compile-time operator?

Originally, this is a part of another question. Why is sizeof called a compile-time operator? Isn't it actually a run-time operator? And if it is indeed a compile-time operator, how does it help in ...
4
votes
3answers
10k views

Understanding stack frame of function call in C/C++?

I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations ...
11
votes
2answers
16k views

What is LPCTSTR?

what is LPCTSTR and LPCTSTR-like (for instance HDC) and what it does stand for?
0
votes
1answer
334 views

Teaching `class`es and objects in C++ to university students

To learn classes and objects at my university, students are required to develop a simple game (nine-mens morris or something similar) using Java. Java is used because of its libraries and tool ...
9
votes
4answers
1k views

Will working in IT limit your career prospects as a programmer? [duplicate]

I took a job working as an IT guy (SQL programming, helpdesk, etc.) because I had need of a job (to pay back student loans accumulated from school). I'm very happy to have a job, but I eventually ...
3
votes
1answer
1k views

How to see bits of an integer in Visual Studio

As far as I know it is not possible to see the bits of an integer in Visual Studio, you can see variables in decimal or hexadecimal format in the Locals and Watch windows in the debugger. Why is this ...
2
votes
2answers
11k views

Choosing between Qt/C++ and .NET/C# [closed]

I have a desktop project I've been working on for a couple months that I want to run on Windows and Mac. When I started the project, I started writing it in Qt 4.8 in C++. Development has gone fine ...
-2
votes
2answers
278 views

About Artificial Intelligence [closed]

I am interested in starting a career in artificial intelligence. Can anyone suggest how I could prepare for this? What languages should I study that would be best for this career choice?
2
votes
1answer
220 views

Using a development language (Python) before putting it into C++ [duplicate]

I'm kinda having a debate here with my friend, whether it's OK to have a development language before putting the idea into C++. When I say development language I mean a language to try ideas out ...
1
vote
1answer
1k views

Performance overhead of standard containers and boost [closed]

Adap.TV has chosen C++ to develop their software. However, they've decided not to use the standard containers1 and boost for performance reasons, as they've blogged about it in the following article: ...
0
votes
2answers
171 views

How to design member access for an Article-type class? [duplicate]

I am doing a final project in a C++ class writing a very simple usenet-like client/server. I figure that since it's usenet-like I'll have a NewsGroup class and an Article class, I'm now working on my ...
1
vote
3answers
2k views

The best way to store dictionary from file

I'm working on a translator in C++. Basically I want to parse the file with translations and store it in my program, so I can perform search through the words and simply access the corresponding word. ...
35
votes
6answers
7k views

Good example of complex code using TDD [closed]

What would be a good example of the use of TDD in large, real-life, complex, projects? All the examples I've seen so far are toy projects for the purpose of a book or a paper... Can you name an ...
2
votes
2answers
625 views

Restrictions Calling DLLs Across Technologies?

I want to call a DLL in my programming language of 'choice'. The documentation surrounding this clearly states that it must be a 32-bit DLL written in C, C++ or Delphi. But I wanted to call a DLL ...
1
vote
1answer
981 views

Big project with many external libraries - source code organisation

I was wondering what is the best way to organize my source code. I was researching on SO and found http://stackoverflow.com/a/1398594/137261 but this source code layout is library specific and doesn't ...
16
votes
5answers
1k views

Would it make sense to use objects (instead of primitive types) for everything in C++?

During a recent project I've been working on, I've had to use a lot of functions that kind of look like this: static bool getGPS(double plane_latitude, double plane_longitude, double plane_altitude, ...
4
votes
1answer
506 views

LGPL, .lib, .dll, and linking

I am trying to build a project which uses an unmodified copy of libconfig (http://www.hyperrealm.com/libconfig/). libconfig is LGPL, but I don't want to open source any of my code. By my ...
0
votes
1answer
2k views

Converting 'char*' to 'char'. Am I passing this array correctly? [closed]

So my CS professor gave the whole class a simple assignment. "Write a recursive function that will swap the order of a section in an array of chars." I thought to myself, "Easy. I'll finish this up in ...
1
vote
1answer
2k views

C++ IDE and tools with Clang integration [closed]

Recently I've read this blog about Google integrating Clang parser into their code analysis tools This is something in which C++ is at least a decade behind other languages like Java, but now that ...
0
votes
3answers
1k views

Can one can survive in the IT industry without knowledge of C and C++? [duplicate]

I am just a graduate from India and I have knowledge of Java, JSP and Servlets, Android application development and some iOS development. I do not have a background in C or C++ and a little weak ...
6
votes
3answers
3k views

Might starting variables/members with an underscore puzzle the compiler?

I've been taught since high school that defining variables like this: int _a; or int __a; should be consider bad practice because this would eventually puzzle compilers that use variables starting ...
2
votes
3answers
1k views

Web developer to software engineer [closed]

I'm currently a web developer building web apps in PHP and Javascript. I really enjoy the programming aspect more so than the front end design side of things. I would to like to start to focus my ...
1
vote
4answers
1k views

Are generic programming and OOP mutually exclusive?

I never did generic programming before, being more of a python guy, and generally using OOP. As I moved into generic programming, I faced some issues. I read the FAQ, but I am not satisfied. What I ...
8
votes
3answers
506 views

Convert an interpreter to a compiler?

First off, I know this is a question asked by MANY other programmers before me. But I couldn't find any useable resource that could help me. Well, I'm creating an programming language called "Light" ...
-1
votes
1answer
452 views

How to interact with C++ API through http commands?

I have a C++ API, I want to send commands through http to run any c++ method from this API. I'm using libmicrohttpd. What steps should I follow to do such a work?
18
votes
2answers
5k views

What are C++/CX and C++/CLI, and how do they relate to C++ and WinRT?

I was considering taking up the challenge of learning C++ for designing Metro apps and that's when I came across C++/CX. Can Metro apps be coded in C++ 11? Do they require C++/CX to work? And what ...
66
votes
7answers
11k views

Why declare a variable in one line, and assign to it in the next?

(I figured this question was already asked, and searched for it, but was unable to find a duplicate; if I missed something, please delete this one and accept my apologies!) I often see in C and C++ ...
0
votes
4answers
443 views

C++ library API: new or getters?

I'm writing a C++ wrapper for my C library (my C++ skills are a bit rusty) and I'm wondering what's preferable: allowing user to construct objects themselves or give them objects via getters? What ...
75
votes
8answers
50k views

Is modern C++ replacing C#? Is Microsoft pushing developers to adopt C++? [closed]

I hear about modern C++ popularity and some talks about migrating back to C++ from C# or other C-like languages. I know about C++11 features but I would like to hear your experiences, especially from ...
8
votes
3answers
9k views

A good C Variable Length Array example

This question got rather a freezing reception at SO, so I decided to delete it there and try here instead. If you think it does not fit here either, please at least leave a comment on suggestion how ...
8
votes
5answers
866 views

Python potential for science applications? [duplicate]

I'm a beginner in programming. I am learning Python as a hobby. However, after reading some things in what concerns, for example, its speed, I asked again myself if I should really learn Python or ...
2
votes
2answers
558 views

About ANSI C++ 2003 standard

I would like to ask for your help. I searched a lot on Internet, but I found mismatched informations. My questions: I tried to buy the "ISO/IEC 14882:2003(E) Programming Languages - C++" standard ...
-3
votes
1answer
389 views

Should i shift from Testing to Development? [closed]

i have 1.2 yrs of experience in Testing in big MNC company, I have good Programming knowledge in Java (Core,Servlets). I have completed ISTQB certification(Testing) and trying for HP QTP ...
29
votes
2answers
2k views

Why is a Boolean value stored as a byte inside of a computer when it only requires one bit

I recently started learning to write code, and in my book I came across this question. "Why is a Boolean value stored as a byte inside of a computer when it only requires one bit?" can someone shed ...
7
votes
3answers
304 views

Is there a way to use gcc as a library?

Anyone knows a solution that works something like this: #include <stdio.h> #include <gcc.h> /* This .h is what I'm looking for. */ int main (void) { /* variables declaration (...) */ ...
26
votes
6answers
12k views

Is it better to document functions in the header file or the source file?

In languages that distinguish between a "source" and "header" file (mainly C and C++), is it better to document functions in the header file: (pilfered from CCAN) /** * time_now - return the ...
0
votes
4answers
828 views

Read K&R before learning low latency C++?

I have never really done a large amount of C programming but am in the middle of teaching myself low latency C++. Would it do more harm than good to read the K&R C programming book? I am a bit ...
2
votes
6answers
3k views

Re-writing a large web application - alternatives to LAMP

We have a very large, 10 year old LAMP (Linux, Apache, MySQL, PHP) web application that is out of control and poorly written due to a large number of patches and possible hundreds of programmers. If ...