当前位置:网站首页>Null and nullptr
Null and nullptr
2022-07-23 07:11:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
traditionally ,c++ hold NULL、0 As the same thing , Some compilers will NULL Defined as ((void*)0), Some define it as 0.
c++ It is not allowed to directly transfer void* Implicitly convert to other types , But if NULL Is defined as ((void*)0),
Compile char *p = NULL;
NULL It has to be defined as 0.
also :
void func(int);
void func(char*);
If NULL Is defined as 0,func(NULL) Going to call void func(int), This is not reasonable
So the introduction of nullptr, Used specifically to distinguish 0、NULL.
nullptr The type of nullptr_t, Can be implicitly converted to any pointer .
So use null pointers as much as possible nullptr.
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/125997.html Link to the original text :https://javaforall.cn
边栏推荐
- 局域网SDN技术硬核内幕 - 前传 CPU里面有什么?
- CAN总线详解
- Kotlin learning quick start (8) - Delegation
- 什么程序员在35岁依然被公司抢着要?打破程序员“中年危机”
- Flink数据源拆解分析(WikipediaEditsSource)
- 分享一个qt实现的登录界面模板
- Cloudwego's design practice in the background platform of flybook management
- 电脑如何快速关机 电脑关机命令分享
- XSS必备知识
- [matlab project practice] analysis of spatial and temporal characteristics of drought in a region based on SPI index
猜你喜欢

【高并发基石】多线程、守护线程、线程安全、线程同步、互斥锁

Demo19- (to be updated)

Livegbs camera web page low delay plug-in free live broadcast implementation

实现OPC UA publish/subscribe单次发送

织梦dedecms忘记管理后台密码找回方法
![[matlab project practice] analysis of spatial and temporal characteristics of drought in a region based on SPI index](/img/a6/33442ad5301c799ba4e5491d818d67.png)
[matlab project practice] analysis of spatial and temporal characteristics of drought in a region based on SPI index

数据库系统设计:分区

Kali tools sqlmap common usage

CV target detection model sketch (1)

Huawei shengteng competition materials
随机推荐
SQL Server中的STRING_SPLIT函数的实现
[FAQ] common reasons and solutions for the failure of in app payment services to pull up the payment page
AE常用表达式汇总「建议收藏」
小黑leetcode之旅:100 相同的树
LUR caching algorithm
Electromagnetic field and electromagnetic wave experiment 4. Be familiar with the application of CST Studio Software in the electromagnetic field
Flink数据源拆解分析(WikipediaEditsSource)
分享一个qt实现的登录界面模板
电脑待机要按什么键解除 解除电脑睡眠模式的步骤
AIRIOT答疑第5期|如何使用低代码业务流引擎?
正向代理,反向代理及XFF
Cloudwego's design practice in the background platform of flybook management
Computer prompts how to deal with insufficient memory. The solution of insufficient computer C disk
电脑一拖二显示器分辨率怎么调? 两个显示器设置不同分辨率的技巧
How to restore the computer screen display zoom tutorial when the computer screen becomes larger
What is the difference between 32-bit and 64 bit computers
局域网SDN技术硬核内幕 - 02 前传 多核技术为摩尔定律续一秒
[matlab project practice] sine sweep (sine sweep signal)
局域网SDN技术硬核内幕 13 二 从局域网到互联网
The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience