当前位置:网站首页>Check if this is null - checking if this is null
Check if this is null - checking if this is null
2022-07-05 00:49:00 【Superior virtue and weak water】
problem :
Does it ever make sense to check if this is null? Check this Whether it is empty or meaningful ?
Say I have a class with a method; Suppose I have a class with methods ;inside that method, I check this == NULL
, and if it is, return an error code. In this method , I check this == NULL
, If it is , The error code is returned .
If this is null, then that means the object is deleted. If this It's empty. , Then this means that the object is deleted .Is the method even able to return anything? Can this method even return anything ?
Update: I forgot to mention that the method can be called from multiple threads and it may cause the object to be deleted while another thread is inside the method. to update : I forgot to mention that this method can be called from multiple threads , It may cause the object to be deleted , Another thread is inside the method .
Solution :
Reference resources : https://stackoom.com/en/question/7ji1边栏推荐
- Leetcode70 (Advanced), 322
- Insert sort of sort
- Several simplified forms of lambda expression
- Huawei employs millions of data governance experts! The 100 billion market behind it deserves attention
- 创新引领方向 华为智慧生活全场景新品齐发
- Huawei employs data management experts with an annual salary of 2million! The 100 billion market behind it deserves attention
- Daily question brushing record (13)
- Ruby tutorial
- [Yocto RM]10 - Images
- Multilingual Wikipedia website source code development part II
猜你喜欢
What did I pay for it transfer to testing post from confusion to firmness?
基本放大电路的学习
Continuous modification of business scenario functions
uniapp微信小程序拿来即用的瀑布流布局demo2(方法二)(复制粘贴即可使用,无需做其他处理)
Two numbers replace each other
OpenHarmony资源管理详解
[STM32] (I) overview and GPIO introduction
Relationship between classes and objects
URL和URI
揭露测试外包公司,关于外包,你或许听到过这样的声音
随机推荐
P4408 [noi2003] truant children (tree diameter)
[Yocto RM]10 - Images
Kibana index, mapping, document operation
P4281 [AHOI2008]紧急集合 / 聚会(LCA)
Is it safe to open an account in the College of Finance and economics? How to open an account?
Learning of basic amplification circuit
[Yocto RM]11 - Features
Parameter passing mechanism of member methods
Leetcode70 (Advanced), 322
每日刷题记录 (十三)
[STM32] (I) overview and GPIO introduction
Acwing164. Accessibility Statistics (topological sorting +bitset)
26.2 billion! These universities in Guangdong Province have received heavy support
ORB(Oriented FAST and Rotated BRIEF)
[Yocto RM]11 - Features
SAP ui5 application development tutorial 106 - how to improve the readability of SAP ui5 application routing URL trial version
【C】(笔试题)指针与数组,指针
User login function: simple but difficult
Actual combat simulation │ JWT login authentication
P3304 [SDOI2013]直径(树的直径)