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

learn more… | top users | synonyms

2
votes
5answers
633 views

Why is TDD not working here?

I want to write a class A that has a method calculate(<params>). That method should calculate a value using database data. So I wrote a class Test_A for unit testing (TDD). The database access ...
0
votes
1answer
365 views

Understanding how memory contents map into a struct [closed]

I am not able to understand how bytes in memory are being mapped into a struct. My machine is a little-endian x86_64. The code was compiled with gcc 4.7.0 from the Win64 mingw32-64 distribution for ...
0
votes
2answers
625 views

When to decide to introduce interfaces (pure abstract base classes) in C++?

Assume that you are developing a functionality and are 90% sure that the implementation class will stay alone. If I was in this position in Java I would probably not use the interface right now to ...
3
votes
3answers
1k views

C++ log every function and parameter values

I want to log every function call and parameter value in my C++ app. Is there a generic approach for this task ? (3rd part library, VAR_ARGS etc.)
2
votes
1answer
392 views

Are C or C++ The Only Viable Languages for a GC

Background I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting ...
0
votes
1answer
123 views

Share Mulitple Classes as one dll or a lib with Mulitple Projects

Currently I have some shared class files(.cpp and .h) which I include them in around 20 Projects. Currently I have to include them in all of the projects. So if I get some business requirments and I ...
0
votes
3answers
189 views

which style of member-access is preferable [duplicate]

the purpose of oop using classes is to encapsulate members from the outer space. i always read that accessing members should be done by methods. for example: template<typename T> class foo_1 { ...
4
votes
4answers
6k views

Putting semicolons after while and if statements in C++

How come in C++ when you put: while (expression); the while loop doesn't run no matter if the expression is true or not. However if you put: if (expression); the statement runs no matter if ...
10
votes
8answers
2k views

Should we persist with an employee still writing bad code after many years? [closed]

I am putting this question to C++ programmers because: a) Only a C++ programmer can judge the technical merits of the examples; b) Only a programmer will have a feel for the temperament of another ...
4
votes
2answers
356 views

Writing Large Portions Of Code Then Debugging?

Lately I have been writing a game engine, and I have been writing a lot of "foundation stuff" (standard interfaces, modules, a message system ect.), but I have noticed a pattern, a lot of the stuff is ...
26
votes
3answers
2k views

Except garbage collector, what else makes Java a non real time programming language

Except the garbage collector, what are some other features in Java that make it unsuitable for real time programming? On the net, whenever Java vs C++ is discussed with regards to real time ...
30
votes
3answers
26k views

Why is Python written in C and not in C++? [closed]

In Python's tutorial one can read that Python's original implementation is in C; On the other hand, the Python implementation, written in C, (...) I'm very curious why was Python written in C ...
17
votes
7answers
5k 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 ...
7
votes
5answers
538 views

Is it a good idea to read compiler source code? [closed]

I'm a junior in college majoring in Computer Science. Apart from writing lots of code, I want to start reading source code written by others to improve my coding skills and learn better/different ways ...
-1
votes
2answers
83 views

Store a tree with near next neighbours

I would to find an efficient structure (speed and volume) to store nodes and their neighbourhood. My input is build out of stings in the following format ./X/Y.log where X ∈ [0,359] and Y ...
1
vote
1answer
585 views

Chrome's multiple process per each tabs

I am wondering what is the purpose of Chrome using multiple processes for each tabs? I asked this to C++ chat room and one responded it is a product of laziness. I personally believe this is an ...
0
votes
2answers
467 views

Do preprocessor defines slow down build times?

I have a very large c++ project and I'm trying to decrease build times. I've been religious about forward declaring and only including files which are used. However I have many preprocessor defines ...
6
votes
2answers
10k views

Pure C++ for iOS apps [closed]

Is it possible to use only C++ to create iOS apps? Is there any downside to that? I read somewhere that you have to use a mix of objective C and C++ if you want to use C++ that bad.
-1
votes
1answer
484 views

How to reconstruct this application using design pattern

I am engaging in redesigning a linux c++ server application. The application acts as file relayer in the form of receiving file packets (incuding control packets and data packets) from client A, ...
33
votes
4answers
9k views

How to make the switch to C++11?

I've been programming in C++ for a while now, but mostly things centered around the low-level features of C++. By that I mean mostly working with pointers and raw arrays. I think this behavior is ...
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 ...
-1
votes
2answers
3k views

how can I improve my c++ skills [duplicate]

Possible Duplicate: Why c++? Where to start? I consider myself a java and python coder. For python (usually not so big project but more scripting and fast stuff) I use vim, for java I use ...
6
votes
3answers
450 views

Coding Convention: C++ Header/Interface Files

I'm reading through a PDF on C++ programming from this page on Stanford's site. It says that when you're creating a C++ header file for a library interface, use a #ifndef preprocessor command to make ...
-1
votes
2answers
250 views

c#/java or c++ (Personal question) [closed]

First of all this is not a comparison between the languages. So I've asked a question before telling that I am a beginner programmer (hardest thing done is a chat server/client when I was reading ...
7
votes
2answers
484 views

Database Facade to wrap our existing queries?

We have a very big application written in C++ using the MFC framework (millions of code lines). No need to say that it's a legacy system, but it's also heavily maintained and updated. This application ...
0
votes
1answer
788 views

Should I use webKit or is there a better technology to make a browser in Windows [closed]

I create web applications most in RoR and PHP. About a year ago a company wanted to use my app but in a stand alone browser window in Linux, so I wrote one in python using webkit, locked it down to ...
5
votes
5answers
2k views

Programming Style in Large Scale C++ Applications

Recently I've been browsing source code of large applications written in C++ to learn a bit but I couldn't help but notice that most if not all use a lot of IFDEFs and class-less functions (where they ...
16
votes
13answers
2k views

Is it an appropriate use of #define to make typing repeated code easier?

Is there any view on whether using the #define to define full lines of code for simplifying coding is good or bad programming practice? For example, if I needed to print a bunch of words together, I'd ...
10
votes
8answers
1k views

Is writing software easier than reading and understanding it from scratch? [closed]

Me and a friend of mine were discussing yesterday about differences between writing a large C++ software and understanding it as a new recruit. Is it possible that since a software gets done one line ...
0
votes
2answers
114 views

I'm trying to figure out which functions from one C library are being used by C project. Does anyone have a simple solution? [closed]

To be specific, I want to know which function/types in libpri and being used in the Asterisk project. I'm not traditionally a C programmer, but I know some basic stuff because I took a class in ...
2
votes
2answers
416 views

C++ Using Intrinsics in a Cross-platform Manner

I have a cross platform math library that I am working on and I want to make sure that some common operations are performed in an optimized manner, so I wish to use some intrinsic functions wrapped in ...
6
votes
3answers
1k views

Is relying on implicit argument conversion considered dangerous?

C++ has a feature (I cannot figure out the proper name of it), that automatically calls matching constructors of parameter types if the argument types are not the expected ones. A very basic example ...
7
votes
3answers
379 views

Change of the complexity class through compiler optimization?

I am looking for an example where an algorithm is apparently changing its complexity class due to compiler and/or processor optimization strategies.
1
vote
1answer
572 views

Balance Tree with depth n has how many nodes maximum?

I couldn't find the answer anywhere, but let's say we have a B-Tree with min = 1 and max = 2: What is the formula to calculate the maximum number of nodes in this B-Tree if the depth is say 100? This ...
7
votes
3answers
856 views

Is it recommendable to program .net apps with C++

From what I can understand, C# is the defacto language when coding .NET apps. Is it recommendable to program .NET apps [let that be ASP.NET, WinPhone 7, GUI, etc] in C++? What are the pitfalls and the ...
2
votes
2answers
744 views

How to port cli c++ program with GNU libraries from windows to Linux

I need to implement some graph partitioning algorithms for my thesis. I have mostly Windows experience. I would like to know if it is hard to migrate c++ console program to Linux. I want to program it ...
2
votes
2answers
456 views

Recompiling dll's and adding more during run time - what are my options?

I want to compile custom functions during run time based on user written scripts. I'll give a hypothetical example that should demonstrate exactly what I need to do. This is the best way for me to ...
11
votes
4answers
2k views

Is it possible to use the Intel C/C++ compiler on Linux to create object files to be linked on Windows?

Why? Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement). Intel ...
19
votes
6answers
2k views

A programming language that allows you to define new limits for simple types

Many languages like C++, C#, and Java allow you to create objects that represent simple types like integer or float. Using a class interface you can override operators and perform logic like checking ...
2
votes
3answers
11k views

Char and unsigned char [closed]

Where is unsigned char used in C ( please tell about some real-world examples )? Why would we need both char and unsigned char? Char ranges from -127 to 128 ( 8-bit integer ) Unsigned Char ranges ...
9
votes
3answers
867 views

C++ 'using': Should I use it or should I avoid it?

I realize there are subtly different semantics for some of these, because of ADL. In general, though: Which one should I prefer (if any), and why? (Or does it depend on the situation (e.g. inline ...
2
votes
3answers
2k views

How does a new programmer plan a code? [duplicate]

I've been learning programming on and off for the past 3 years never dedicating any meaningful amount of time until recently. Something that has confused me about programming is: How do you start ...
0
votes
2answers
288 views

The best way of coding web system in term of performance [closed]

So far I've been using IPB and my custom scripts all coded in PHP but I am really disappointed of the long term performance of it. I would like to move to native coding, the learning time to put into ...
5
votes
7answers
2k views

Ensuring that headers are explicitly included in CPP file

I think it's generally good practice to #include the header for any types used in a CPP file, regardless of what is already included via the HPP file. So I might #include <string> in both my HPP ...
43
votes
3answers
12k views

Can somebody explain me what are lambda things in programming?

So far I heard about : Lambda calculus Lambda programming Lambda expressions Lambda functions Which all seems to be related to functional programming... Apparently it will be integrated into ...
1
vote
2answers
1k views

Why is C++ preferred over C for commercial applications? [closed]

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++. As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and ...
1
vote
1answer
324 views

Portability: Python's C/C++ libraries/extensions vs JRuby's Java libraries

I've had some discussion with colleagues who chose to go with JRuby along the following line of argumentation: JRuby can make use of anything that is available in Java, ergo such programs are more ...
3
votes
4answers
617 views

Initializing derived classes in the same way

I have a class Base that has several children, say A, B, C. For testing purposes I'd like to mock those derived classes by deriving from them. So MockA derives from A, MockB derives from B and so on. ...
29
votes
8answers
17k views

Are C and/or C++ viable/practical options for web development? [duplicate]

I am proficient in C, and I am learning C++ right now. I always played with websites (HTML/CSS), and I was wondering if it would be viable/practical to create some simple web apps using C and/or C++. ...
8
votes
2answers
1k views

Would Task-based programming in C++ require new language standard features?

So I saw this video on Youtube with all these C++ masters on GoingNative 2012 : Interactive panel where everybody could ask the questions. This is the video I was talking about: GoingNative 2012 - ...