Featured Post

Efficient Duplicate Image Removal: Using ImageDeDup Python

Efficient Duplicate Image Removal: A Python Guide In this blog post, we will walk you through the process of identifying and removing duplicate images from your directories using Python. We will leverage perceptual hashing to find similar images and delete duplicates while keeping the largest file in the group. This solution is perfect for users who want to save disk space and keep their image collections organized. Why You Should Use This Code Over time, especially when dealing with large collections of images, duplicate files can accumulate. These duplicates take up unnecessary space on your system. Manually sifting through these images can be tedious, but with the help of Python, perceptual hashing, and concurrent processing, this task becomes much easier. Benefits: Efficient Duplicate Detection : By using perceptual hashing (PHash), the code compares images based on their v...

The bug in the name of the C++ language.

From the internet, a popular quote goes like this: 

"Of course, while it is true that the ++ operator gives the C++ language its name, it also led to the first joke about the language. C++ haters point out that even the name of the language contains a bug: 'After all, it should really be called ... ++C, because we only want to use a language after it has been improved.' "

We will now see why this joke is so absolutely hilarious. 



int main()
{
int x = 40;
int y = ++x + 1;
std::cout << x << '\n' << y;
}


Output: x = 41, y = 42.

The pre-increment operator first increments the value of (the ++) and then stores it in the variable. Hence, when the code is executed, x becomes 41 AFTER being assigned to .

The post-increment works the other way, the value is first stored in the lvalue before being assigned to the rvalue of the variable being incremented. 


int main()
{
int x = 40;
int y = x++ + 1;
std::cout << x << '\n' << y;
}


Output: x = 41, y = 41

So, technically:

C++ means: First use C and then increment it (improve it). 
++C means: First improve C and then use it. 

So, yes, it should have been ++C!

Comments

  1. This must have been the incrementation that is used in a loop.

    ReplyDelete
  2. maybe it could be that you should know the c language first and then increment it because c is a subset of c++

    ReplyDelete

Post a Comment

Let's discuss and learn more

Related Posts

Entity Attribute Value Model

Efficient Duplicate Image Removal: Using ImageDeDup Python

The Apple Two