V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  koebehshian  ›  全部回复第 1 页 / 共 18 页
回复总数  350
1  2  3  4  5  6  7  8  9  10 ... 18  
The C Programming Language 附录 A ,A.8 Declarations 中说:

```
Declarations specify the interpretation given to each identifier; they do not necessarily reserve storage associated with the identifier. Declarations that reserve storage are called definitions.
```

所以,首先要明白,definition 是 declaration 的一种,区别在于 definition 为变量预留了内存
所以,你的问题应该修改为:int a; 有没有预留内存。

答案是:大多数情况下预留了内存。只有一种情况,就是写在函数外面

A.10.2 External Declarations 中说:

```
An external object declaration that does not have an initializer, and does not contain the extern specifier, is a tentative definition. If a definition for an object appears in a translation unit, any tentative definitions are treated merely as redundant declarations.
```

意思是,int a; 写在函数外面,编译器先会将其待定;如果发现整个编译单元(一般是一个预处理过的源文件)中有多个这样的写法,则多余的就被当作没有预留内存的 declarations 了
37 天前
回复了 Margelator 创建的主题 问与答 写一句你所知的计算机界名言名句。
1. 世界上只有 10 种人,懂 10 进制的,不懂 10 进制的。
2. 没有什么是重启解决不了的,如果不行,那就 2 次
39 天前
回复了 saveai 创建的主题 职场话题 大家公司有开年红包吗?
1 月的工资今天才发,大概就算是开年红包了
不能怪 GCC ,你把只读的 cast 掉,然后修改,不出 bug 就怪了。
我觉得就是抓痒一样,咳了一下,就想再咳一下,所以能忍住就忍一下。

当然,一般是中病毒了,人体的细胞工作需要合适的温度,冷的话注意保暖,发热的话用湿毛巾降温。口渴就多喝水,没胃口的话就少量多次,毕竟这是与病毒斗争的弹药。最主要心态要好,多通风,保持卫生。
127 天前
回复了 kkkbbb 创建的主题 C c 语言中自定义 section 段问题请教
我测试了一下,是按定义的顺序排的,并不是名称的 ASCII 码,RT-Thread 的链接脚本把段排序了:
https://github.com/RT-Thread/rt-thread/blob/896b1fe2dac161a24281cb0b0de92ede3f462778/bsp/stm32/libraries/templates/stm32f10x/board/linker_scripts/link.lds#L42
128 天前
回复了 kkkbbb 创建的主题 C c 语言中自定义 section 段问题请教
我看 RT-Thread  ( https://club.rt-thread.org/ask/article/d686458bbba864f4.html) 是用不同的段名表示 start 与 end ,以及执行的初始化函数,也就是有 3 个 section ,按 ASCII 排序的。
147 天前
回复了 cosmain 创建的主题 Linux Linux 时区环境变量 TZ 的一个问题
维基百科看看就行了,配合 hexdump 一下
多维宇宙了解下
开音节发字母的音:爱、易、阿伊,欧,优
闭音节发字母原来的音:阿,唉,伊,噢,阿

ma-ven, 故 a 在开音节,念“爱”,音节整体念“埋”
lam-da, 故第 1 个 a 在闭音节,念“阿”,音节整体念“拉木”
kot-lin ,故 o 在闭音节,念“噢”,音节整体念“考特”
214 天前
回复了 richangfan 创建的主题 随想 一天一顿饭的好处太多了
和尚好像只吃早饭,过午不食
220 天前
回复了 jonathanchoo 创建的主题 问与答 没房可以相亲吗
根据我的经验,如果不要求有房,那么其他方面的要求就高了
不行就手动 source 一下
我只碰到讲话有烟味的,还好没坐在他旁边
231 天前
回复了 sunhang09 创建的主题 Linux Linux 终端中从此告别枯燥频繁的 cd
不会多开几个 tab ?
256 天前
回复了 ersansan233 创建的主题 生活 养老金已经交了 10w
我一直当税交的
@iorilu 前 2 点我会,就第 3 点不会
小白问一下,软件是怎么防破解的
1  2  3  4  5  6  7  8  9  10 ... 18  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2760 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 39ms · UTC 12:05 · PVG 20:05 · LAX 05:05 · JFK 08:05
Developed with CodeLauncher
♥ Do have faith in what you're doing.