Tag: c++

61 votes
10 answers
681 views
How to view the assembly behind the code using Visual C++?

I was reading another question pertaining the efficiency of two lines of code, and the OP said that he looked

avatar
Cortez
0 1 0 9
asked 07 September, 2021
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
66 votes
13 answers
1.7K views
Can num++ be atomic for 'int num'?

In general, for int num, num++ (or ++num), as a read-modify-write operation, is not atomic. But I often see co

avatar
Forrest
0 1 0 9
asked 07 September, 2021
64 votes
21 answers
381 views
Is inline assembly language slower than native C++ code?

I tried to compare the performance of inline assembly language and C++ code, so I wrote a function that add tw

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
66 votes
24 answers
1.4K views
Protecting executable from reverse engineering?

I've been contemplating how to protect my C/C++ code from disassembly and reverse engineering. Normally

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
55 votes
17 answers
1.5K views
How do you get assembler output from C/C++ source in gcc?

How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted ass

avatar
Winford
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
666 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
660 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
62 votes
11 answers
1.3K views
Fast ceiling of an integer division in C / C++

Given integer values x and y, C and C++ both return as the quotient q = x/y the floor of the floating point eq

avatar
Patsy
0 1 0 9
asked 07 September, 2021
58 votes
7 answers
1.9K views
Fastest way to determine if an integer is between two integers (inclusive) with known sets of values

Is there a faster way than x >= start && x <= end in C or C++ to test if an integer is between t

avatar
Stacia
0 1 0 9
asked 07 September, 2021
51 votes
21 answers
737 views
Is there a standard sign function (signum, sgn) in C/C++?

I want a function that returns -1 for negative numbers and +1 for positive numbers. http://en.wikipedia.org/wi

avatar
Dorinda
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
60 votes
6 answers
2.1K views
Why is std::map implemented as a red-black tree?

Why is std::map implemented as a red-black tree? There are several balanced binary search trees (BSTs) out th

avatar
Venice
0 1 0 9
asked 07 September, 2021
55 votes
14 answers
808 views
Why does the C++ STL not provide any "tree" containers?

Why does the C++ STL not provide any "tree" containers, and what's the best thing to use instead? I want

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
63 votes
27 answers
2.9K views
Why is processing a sorted array faster than processing an unsorted array?

Here is a piece of C++ code that shows some very peculiar behavior. For some strange reason, sorting the data

avatar
Boyd
0 1 0 9
asked 07 September, 2021