memesearch
Why Everyone Says Use C++

Why Everyone Says Use C++

Download Find similar pictures
Text on the meme
Why does everyone keep telling me to use c++? C My task was to create a function in C that would take an integer, find the right-most 0, flip it to a 1, and flip all the 1's to the right of it to 0's. I don't understand why, but everyone tells me to just use c++ instead? Strange. uint32_t func(uint32_t c) { uint32_t i = 1; while (i != 0) { // Searches for the right-most 0 if ((c & i) == 0) { // Tests if the bit is a zero break; } i <<= 1; }; if (i != 0) { c |= i; // Flips the right-most 0 to a 1 } else { c = ~c; // If no zeros were found, then it was probably hidden in the carry bit, flip all 1's to the right of it } i >>= 1; // Start at the 1 next to the right-most 0 while (i != 0) { // Flip all 1's to the right of it to 0's c &= ~i; i >>= 1; }; return c; }
What it means

A screenshot shows a programming question about implementing a bit-manipulation function in C, followed by a long C code solution. The joke is that although the task is deliberately written in cumbersome low-level C, everyone keeps suggesting C++ instead, making the programmer wonder why. EN: A screenshot shows a programming question about implementing a bit-manipulation function in C, followed by a long C code solution. The joke is that although the task is deliberately written in cumbersome low-level C, everyone keeps suggesting C++ instead, making the programmer wonder why.

Objects
Tags
Sources
Type
image
Size
506×800 · 72.4 KiB
Mood
sarcastic, absurd
Language
en
Added