C++

C++ is a general-purpose programming language. It was originally designed as an extension to C, and keeps a similar syntax, but is now a completely different language. Use this tag for questions about code (to be) compiled with a C++ compiler. Use a version specific tag for questions related to a specific standard revision [C++11], [C++17], etc.

59 votes
14 answers
2K views
How can I see the assembly code for a C++ program?

How can I see the assembly code for a C++ program? What are the popular tools to do this?

avatar
Vi
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
663 views
How do I achieve the theoretical maximum of 4 FLOPs per cycle?

How can the theoretical peak performance of 4 floating point operations (double precision) per cycle be achiev

avatar
Dorian
0 1 0 9
asked 07 September, 2021
58 votes
11 answers
1.9K views
Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly?

I wrote these two solutions for Project Euler Q14, in assembly and in C++. They implement identical brute forc

avatar
Deedee
0 1 0 9
asked 07 September, 2021
64 votes
11 answers
1.9K views
Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviations with _mm_popcnt_u64 on Intel CPUs

I was looking for the fastest way to popcount large arrays of data. I encountered a very weird effect: Changin

avatar
Daniel
0 1 0 9
asked 07 September, 2021
62 votes
14 answers
658 views
Is < faster than <=?

Is if (a < 901) faster than if (a <= 900)? Not exactly as in this simple example, but there are slight p

avatar
Trudy
0 1 0 9
asked 07 September, 2021
59 votes
20 answers
1.3K views
How can I profile C++ code running on Linux?

I have a C++ application, running on Linux, which I'm in the process of optimizing. How can I pinpoint wh

avatar
Roger
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
1.3K views
LNK2038: mismatch detected for &apos;RuntimeLibrary&apos;: value &apos;MT_StaticRelease&apos; doesn&apos;t match value &apos;MD_DynamicRelease&apos; in file.obj

I am Integrating Matlab, C and Cuda together in a project. I used Matlab mix in order to connect matlab mx fun

avatar
Trudy
0 1 0 9
asked 07 September, 2021
58 votes
8 answers
1.9K views
Why do C++ libraries and frameworks never use smart pointers?

I read in a few articles that raw pointers should almost never be used. Instead they should always be wrapped

avatar
Kristopher
0 1 0 9
asked 07 September, 2021