当前位置:网站首页>C Pitfalls and Defects Chapter 7 Portability Defects 7.6 Memory Location 0
C Pitfalls and Defects Chapter 7 Portability Defects 7.6 Memory Location 0
2022-08-01 21:10:00 【weixin_Guest time】
Memory location 0
The null pointer does not point to any object.Therefore, it is illegal to use a null pointer for any purpose other than assignment or comparison operations.
Strictly speaking, this is not a portability issue: the effects of misusing a null pointer are undefined in all C programs.The easiest way to check for such problems is to move the program to run on a machine that does not allow access to memory location 0.
Reveal how C handles memory address 0:
#include
int main() {
char *p;
p = NULL;
printf("Location 0 contains %d\n", *p);
return 0;
}
边栏推荐
- 使用百度EasyDL实现厂区工人抽烟行为识别
- 测试的意义并不是能找到全部的缺陷
- JVM内存结构详解
- Realize the superposition display analysis of DWG drawing with CAD in Cesium
- C陷阱与缺陷 第7章 可移植性缺陷 7.8 随机数的大小
- (七)《数电》——CMOS与TTL门电路
- JSD-2204-Knife4j框架-处理响应结果-Day07
- ORI-GB-NP半乳糖介导冬凌草甲素/姜黄素牛血清白蛋白纳米粒的研究制备方法
- C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
- 职场如象棋,测试/开发程序员如何突破成长瓶颈期?
猜你喜欢
职场如象棋,测试/开发程序员如何突破成长瓶颈期?
包含吲哚菁绿的多聚体白蛋白纳米球/载马钱子碱纳米粒的牛血清白蛋白微球的制备
R语言进行相关的操作
在Cesium中实现与CAD的DWG图叠加显示分析
PyTorch笔记 - Attention Is All You Need (2)
CS-NP白蛋白包覆壳聚糖纳米颗粒/人血清白蛋白-磷酸钙纳米颗粒无机复合材料
Jmeter实战 | 同用户重复并发多次抢红包
Transplant MQTT source code to STM32F407 development board
LeetCode·每日一题·1374.生成每种字符都是奇数个的字符串·模拟
牛血清白蛋白刺槐豆胶壳聚糖缓释纳米微球/多西紫杉醇的纳米微球DTX-DHA-BSA-NPs
随机推荐
Pytorch框架学习记录9——非线性激活
左旋氧氟沙星/载纳米雄黄磁性/As2O3磁性Fe3O4/三氧化二砷白蛋白纳米球
【接口测试】JMeter调用JS文件实现RSA加密
封装一个管理 url 状态的 hook
对C语言结构体内存对齐的理解
tiup mirror init
C Pitfalls and pitfalls Appendix B Interview with Koenig and Moo
Record the first PR to an open source project
Based on FPGA in any number of bytes (single-byte or multibyte) serial port (UART) to send (including source engineering)
网红驼背矫正产品真的管用吗?如何预防驼背?医生说要这样做
位运算简介
ORI-GB-NP半乳糖介导冬凌草甲素/姜黄素牛血清白蛋白纳米粒的研究制备方法
Goroutine Leaks - The Forgotten Sender
JS Improvement: Handwritten Publish Subscriber Model (Xiaobai)
C专家编程 第1章 C:穿越时空的迷雾 1.4 K&R C
tiup mirror grant
Excel advanced drawing techniques, 100 (22) - how to respectively the irregular data
StringTable Detailed String Pool Performance Tuning String Concatenation
Imitation cattle forum project
Review Set/Map basics with these two hooks