The difference between null = = A and a = = null

Time:2020-1-9

In the project code, we often see some old drivers write like this in the if judgment: if (null = = a), and I write if (a = = null) because of my habit. What’s the difference between the two?

In fact, there is no difference between the two, but the former deals with details. When we judge the code as empty, we may write if (a = = null) as if (a = null) because of our quickness. This can be compiled in some languages, but the result will be an error, which will make us spend time to find the problem. However, if (null = a) compilation must report errors, so it can reduce the time of troubleshooting to a certain extent.

Some friends may say that in the C ා environment, both of these situations seem to report errors, such as:

 

It seems that it is, but have you forgotten the new dynamic type of C? The compilation passed, but it exploded when it ran.

 

So, good procedures start with details.

Reference: https://blog.csdn.net/dajian35/article/details/81503292

Recommended Today

Commodity interface of e-commerce system design

Preface I should be one of the few people to show interface documentation directly in the article. In this article, I have thought about whether to analyze the attention points of commodity interface development for a long time. Client development and server development are both natural enemies and brothers. I hope this article can help […]