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

learn more… | top users | synonyms

2
votes
2answers
590 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 ...
0
votes
1answer
936 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
476 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
1k 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 ...
12
votes
4answers
8k views

C++ why & how are virtual functions slower?

Can anyone explain in detail, how exactly the virtual table works & what pointers are associated when virtual functions are called. If they are actually slower, can you show the time that the ...
3
votes
3answers
983 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
495 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
440 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?
17
votes
2answers
4k 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
10k 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
437 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 ...
74
votes
8answers
48k 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
8k 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
833 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
525 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
372 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 ...
28
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
302 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 (...) */ ...
24
votes
6answers
11k 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
795 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 ...
10
votes
4answers
1k views

Command pattern design

I have this old implementation of the Command pattern. It is kind of passing a Context through all the DIOperation implementation, but I realized later on, in the process of learning and learning ...
-5
votes
3answers
488 views

How is an IDE compiled? [closed]

I'd like to know the general procedure of how an IDE is built/compiled/created. Additionally, what are some tools/scripts used to create an IDE? I don't mean to say that compiling IDE needs an IDE. ...
4
votes
3answers
842 views

C++ vs Objective-C design principles of setters and getters

In C++ I was told that my classes shouldn't have getters and setters: Doing it wrong... blog post. On the other hand, in Objective-C, the direct use of ivar is discouraged, because the getters allow ...
8
votes
4answers
810 views

When to import names into the global namespace? (using x::y, from x import y etc.)

I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
39
votes
9answers
24k views

std::shared_ptr as a last resort?

I was just watching the "Going Native 2012" streams and I noticed the discussion about std::shared_ptr. I was a bit surprised to hear Bjarne's somewhat negative view on std::shared_ptr and his comment ...
5
votes
4answers
8k views

How does one interface C++ with the web (at Google, for example)?

Google is well known for the ridiculous amount of C++ they've coded over the years. Correct me if I'm wrong, but a large part of Google's core search engine is written in C++, isn't it? How does one ...
2
votes
2answers
3k views

Nested Enum type in C++ or C#?

I've come across a recurring issue in a few of my recent projects in which I find myself using enums to represent state, or type, or something else, and I need to check against a few conditions. Some ...
1
vote
2answers
1k views

C++ Typecasting VS performance

Let's say we're designing a video game. We have some sprites on the map and we want to call some method of the particular sprite at some particular position. We are using one broadly-known C++ ...
0
votes
1answer
782 views

What is the C++ convention, if any, for naming to differentiate between structure types and other types? [closed]

In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures. I had the ...
5
votes
3answers
760 views

Handling false positives and legacy code warnings in static-analysis of C++ code? [closed]

We have a large "legacy" C++ code base on which no static analysis is run at the moment. Every now and then, we are thinking about at least using cppcheck, maybe via Visual Lint. (I've also briefly ...
4
votes
2answers
7k views

Low Latency Unix/Linux

Most low latency/high frequency programming jobs (based on job specs) appear to be implemented on unix platforms. In a lot of the specs they make particular request for people with "low latency linux" ...
63
votes
16answers
11k views

Do I really need oop for my kind of job? After 10 years I think I don't [closed]

After 10 years of writing something like business logic for my company I realized that for 95% of my code I just don't need any special OO techniques. For years I tried to get better with all that OO ...
3
votes
4answers
4k views

Fast compression in C++ and decompression in C#

Overview I am working on a client-server application. The client is written in C++ (working on Windows, planning to support Linux) and the server is a .NET RESTful service. I need to HTTP POST some ...
1
vote
3answers
647 views

Is this Observer variant an improvement?

In a C++ code base I've been working on, they have a bunch of instances of the observer pattern, but it's a little different from the classical pattern. In the classic, the Observer is a specific ...
3
votes
2answers
317 views

What happens when using address before it's allocated?

The very simple piece of C++ code below is incorrect, it's easy to see why and tools like Valgrind will tell you. In running several C++ codes containing this kind of error, I noticed that each time, ...
5
votes
4answers
787 views

Is it possible to create a 2d game for both linux and windows with next to no changes?

I'm starting a project with friends which would preferably reach both audiences of windows and linux. The only problem is that none of us have any experience of linux porting or linux coding any way. ...
0
votes
2answers
202 views

Is there anything special to consider when writing my own exception class in C++? [closed]

If I wanted to implement my own version of the std::exception for no good reason, are there any special things about implementing this kind of object that I should be aware of? It seems like a fairly ...
18
votes
4answers
1k views

Detecting misusage of delete[] vs. delete at compile time

I'd like to know if it's possible to detect the delete error commented below at compile time? Especially, I'd like to hear about g++ compiler. ClassTypeA *abc_ptr = new ClassTypeA[100]; ...
6
votes
3answers
1k views

A question regarding linked list vs vector insert/remove results comparison

I was reading this blog post: http://kjellkod.wordpress.com/2012/02/25/why-you-should-never-ever-ever-use-linked-list-in-your-code-again/ and I found there a code to run: http://ideone.com/62Emz ...
1
vote
1answer
364 views

Is this an implementation of the promise pattern?

I am writing a library in C++ (making use of many C++11 features) that (as far as I can tell) implements the promise pattern. The library consists of a class that makes asynchronous network requests. ...
1
vote
1answer
1k views

Environment Variables and Visual Studio 2012

I have a problem with Visual Studio 2012 and Environment Variables under Windows 7. I added a variable called {LIBS} with the value C:/libs/. In C:/libs/ are folders containing C++ libraries. So far, ...
1
vote
2answers
220 views

Would it be bad design to abstract a graphics library and wrap it in a single class? [duplicate]

I'm starting a game project in C++ using the SFML. It provides various classes for handling graphics, input, etc, but I would like to wrap it all up in a single Media class. I believe that by doing ...
0
votes
3answers
281 views

C/C++ in applications that do not concern performance [closed]

C is the best language (or maybe the single language) suitable for operating systems, drivers, embedded systems etc. For more complex domains like computer graphics C++ is a better choice. But these ...
7
votes
1answer
2k views

Is C a regular language?

Are C or C++ regular languages? If not, under which category do we place the programming languages like C/C++, perl, Python?