Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
7
votes
2answers
8k views

Google Chrome Extension Development for Dummies? [closed]

I want to get started writing extensions for Google Chrome. I am a long time C, C++, Delphi, etc. developer for many years with some Java skills. I believe Chrome extensions are written in C++ but ...
41
votes
3answers
103k views

What is the role of C++ today?

Currently I'm an IT student and I'm wondering what is still important in C++ today, what for is it used? I completed basic C++ course in my university but I can't imagine where can I use my knowledge ...
6
votes
2answers
3k views

Smart Pointers inside class vs Normal Pointers with Destructor

Regarding pointers which are members of classes. Should they be of a smart pointer type or is it enough to simply deal with them in the destructor of the class they are contained in?
7
votes
3answers
437 views

Beginner Trying to Understand Existing Project

I have a project that requires me to control movement of SCARA robot using VC. I am a beginner in programming so I thought of using existing program as my reference. The SCARA robot that I am using is ...
26
votes
11answers
31k views

Avoid Postfix Increment Operator

I've read that I should avoid the postfix increment operator because of performance reasons (in certain cases). But doesn't this affect code readability? In my opinion: for(int i = 0; i < 42; i++)...
15
votes
6answers
6k views

How to explain that writing universally cross-platform C++ code and shipping products for all OSes is not that easy?

Our company ships a range of desktop products for Windows and lots of Linux users complain on forums that we should have been written versions of our products for Linux years ago and the reason why we ...
-2
votes
3answers
833 views

web vs desktop? (php vs c++?) [closed]

I need to write a simple file transfer mechanism (that isn't ftp). Firstly, it must have a GUI. Secondly, it must not be dropbox. Third, it may not use any paid libraries, and hopefully, it uses open ...
3
votes
2answers
3k views

Where do I go to hire a freelance programmer? [closed]

I want to hire a programmer freelance to develop a small InDesign plugin, but I have no idea how to go about finding one. Most of the freelance bidding sites are garbage, but aside from finding a few ...
2
votes
3answers
3k views

c++ write own xml parser vs using tinyxml

I am currently in a task to generate an XML file for an srt text file containing timestamps and corresponding text. To generate an exe file which accepts file name input and outputs the relevant XML ...
6
votes
6answers
1k views

In C++, is it a reflection of poor software design if objects are deleted manually?

With the advent of smart pointers, is it a sign of poor design if I see objects are deleted? I'm seeing some software components in our product that people are still doing this. This practice strikes ...
45
votes
9answers
37k views

Why are pointers not recommended when coding with C++?

I read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the ...
20
votes
6answers
26k views

Why can you have the method definition inside the header file in C++ when in C you cannot?

In C, you cannot have the function definition/implementation inside the header file. However, in C++ you can have full method implementation inside the header file. Why is the behaviour different?
15
votes
7answers
199k views

Game programming : C# or C++? [closed]

I've decided what I really want is to do game programming. So the question is, as a 18 years old who wants to learn self taught programming, what is the most suited programming language between C# and ...
8
votes
3answers
2k views

Detailed C++ book for a programmer already familiar with C and object-oriented programming? [closed]

I know (to some extent) a few languages, including C, Java and Python. I'm also (somewhat) familiar with Scala and Scheme, plus I can read (but not write) x86 Assembly. Say I want to learn C++, what ...
22
votes
9answers
11k views

Why there is no power operator in Java / C++?

While there is such operator - ** in Python, I was wondering why Java and C++ don't have one too. It is easy to make one for classes you define in C++ with operator overloading (and I believe such ...
2
votes
3answers
2k views

Origin of wParam and lParam

Given a standard windows procedure function: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); Where do the names wParam and lParam come from and what the history ...
34
votes
9answers
117k views

Can C++ be used as a server-side web development language? [closed]

I'd like to get into web development using C++ as the "scripting language" on the server-side. My server infrastructure is *nix based, so doing web development in C++ on Azure is not applicable and C+...
27
votes
5answers
11k views

Are C++ templates just a kind of glorified macros?

From different comparisons among C++ templates and C#/Java generics like this one- https://stackoverflow.com/questions/31693/what-are-the-differences-between-generics-in-c-and-java-and-templates-in-c/...
20
votes
3answers
2k views

Is there a measure of code rot? [duplicate]

I'm dealing, again, with a messy C++ application, tons of classes with confusing names, objects have pointers into each other and all over, longwinded Boost and STL data types, etc. (Pause and ...
15
votes
10answers
3k views

What is the best aproach for coding in a slow compilation environment

I used to coding in C# in a TDD style - write/or change a small chunk of code, re-compile in 10 seconds the whole solution, re-run the tests and again. Easy... That development methodology worked ...
19
votes
8answers
38k views

c style casts or c++ style casts

So, what do you use? int anInt = (int)aFloat; or int anInt = static_cast<int>(aFloat); // and its brethren And, more importantly, why?
37
votes
5answers
37k views

Best practices for using namespaces in C++ [closed]

I have read Uncle Bob's Clean Code a few months ago, and it has had a profound impact on the way I write code. Even if it seemed like he was repeating things that every programmer should know, ...
6
votes
9answers
2k views

What should a C++ developer expect on an interview at a Rails company? [closed]

I have been working on C++ backend large scale apps for over 5 years. I'm doing TDD, using STL and Boost etc. I decided I need a change and about year ago started learning Ruby, and few months ago I ...
5
votes
6answers
2k views

Designing for an algorithm that reports progress

I have an iterative algorithm and I want to print the progress. However, I may also want it not to print any information, or to print it in a different way, or do other logic. In an object oriented ...
3
votes
3answers
2k views

Interop Best Practices: Should I use Static Class, or Normal Classes

I have a front end C# that needs to call a C++ back end. So interop is needed. I have an "interop layer", that converts the C# data structure into C++ structure, and do all the memory freeing grunt ...
12
votes
4answers
6k views

Ways to organize interface and implementation in C++

I've seen that there are several different paradigms in C++ concerning what goes into the header file and what to the cpp file. AFAIK, most people, especially those from a C background, do: foo.h ...
20
votes
7answers
9k views

Learning C++ properly (not C with classes) [duplicate]

The typical reason I hear to why people bash C++ is that they don't actually know C++, they just know "C with classes", which apparently is different. I am just beginning to learn C++, however, I want ...
12
votes
12answers
3k views

Is C++ not suitable for OOP? [closed]

I read somewhere in one of the answers to a question here (can't remember which) that C++ is not suitable for object-oriented programming. There was some mentioning that you could make use of its ...
10
votes
9answers
1k views

How important is it that you know the C++ standard?

I did try searching, but I did not see a similar question (either that or my search terminology was incorrect - if so, feel free to close). I am an avid user of SO, and I notice that there are lots ...
138
votes
15answers
28k views

Why did memory-managed languages like Java, Javascript, and C# retain the `new` keyword?

The new keyword in languages like Java, Javascript, and C# creates a new instance of a class. This syntax seems to have been inherited from C++, where new is used specifically to allocate a new ...
5
votes
4answers
4k 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 ...
5
votes
11answers
5k views

Learning C, C++ and C# [duplicate]

I'm sure you guys are tired of this question but after wading through hours of similar posts and questions I've really not made any progress to my specific concerns. I was hoping you guys could shed ...
35
votes
13answers
29k views

Worst practices in C++, common mistakes [closed]

After reading this famous rant by Linus Torvalds, I wondered what actually are all the pitfalls for programmers in C++. I'm explicitly not referring to typos or bad program flow as treated in this ...
3
votes
6answers
6k views

how to prove the complexity of an algorithm mathematically

I know the fundamental algorithms and it's complexities. for e.g if Binary Search has Complexity O(log n), then how I can mathematically prove this?
26
votes
25answers
39k views

Is C++ suitable as a first language? [closed]

A local college is teaching C++ to first year college students (16 years old) with no prior programming experience. As first programming language, is C++ suitable?
11
votes
9answers
530 views

Studies on code documentation productivity gains/losses

After much searching, I have failed to answer a basic question pertaining to an assumed known in the software development world: WHAT IS KNOWN: Enforcing a strict policy on adequate code ...
8
votes
6answers
9k views

What should I know about C++? [closed]

I've recently started learning C++, and I enjoy it a lot. I've often read it's easier to write bad code in C++ than in most languages, and that it is a lot deeper than what it seems. As I'd like to ...
25
votes
22answers
15k views

Is learning how to use C (or C++) a requirement in order to be a good (excellent) programmer? [closed]

When I first started to learn how to program, real programmers could write assembly in their sleep. Any serious schooling in computer science would include a hefty bit of training and practice in ...
55
votes
15answers
5k views

Why do we have postfix increment?

Disclaimer: I know perfectly well the semantics of prefix and postfix increment. So please don't explain to me how they work. Reading questions on stack overflow, I cannot help but notice that ...
100
votes
14answers
62k views

Why are most browsers developed in C++ [closed]

It seems like most of common web browsers (Firefox, Chrome, Safari) are developed using C++. Whys is that so?
7
votes
6answers
10k 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 ...
21
votes
9answers
37k views

How is C different from C++?

Many people have said that C++ is a completely different language than C, but Bjarne himself has said that C++ is a language that is extended from C hence that is where the ++ comes from. So why does ...
29
votes
6answers
24k views

Programming language usage at Google [closed]

I have heard Google uses Python, Java and C++. But what I don't know is how is each of those programming language is used. I mean what is Python, Java and C++ is used for at Google. Why would they ...
2
votes
1answer
543 views

How does compiler handle exceptions that are implicit? Looking for design strategies

Throughout the function handleException, the exception encountered is implicit. How does the compiler handle such implicit passing of exceptions? [For e.g. in C++ methods, this pointer is passed to ...
5
votes
6answers
4k views

C++: calling non-member functions with the same syntax of member ones

One thing I'd like to do in C++ is to call non-member functions with the same syntax you call member functions: class A { }; void f( A & this ) { /* ... */ } // ... A a; a.f(); // this is the ...
10
votes
10answers
3k views

Prefer algorithms to hand-written loops?

Which of the following to you find more readable? The hand-written loop: for (std::vector<Foo>::const_iterator it = vec.begin(); it != vec.end(); ++it) { bar.process(*it); } Or the ...
19
votes
6answers
8k views

Inline functions in C++. What's the point?

According to what I read, the compiler is not obliged to substitute the function call of an inline function with its body, but will do so if it can. This got me thinking- why do we have the inline ...
25
votes
5answers
30k views

What to do if I hate C++ header files?

I was always confused about header files. They are so strange: you include .h file which doesn't include .cpp but .cpp are somehow compiled too. Recently I joined a team project, and of course, ...
48
votes
11answers
4k views

What can I do when the interviewer doesn't know the answer to his/her own question? [closed]

Yesterday I had a terrible experience in an interview. Interviewer asked me about pure virtual function. I said, It may or may not have definition in base class, but derived classes should provide ...
8
votes
3answers
436 views

What are some reasonable stylistic limits on type inference?

C++0x adds pretty darn comprehensive type inference support. I'm sorely tempted to use it everywhere possible to avoid undue repetition, but I'm wondering if removing explicit type information all ...