⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nullvs0.rs.html

📁 this is a mirrored site c-faq. thought might need offline
💻 HTML
字号:
<html><!-- Mirrored from c-faq.com/null/nullvs0.rs.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:59:50 GMT --><head><title></title></head><body>From: Richard Stamp<br>Newsgroups: comp.lang.c<br>Subject: Re: NULL vs Int 0<br>Date: Sun, 7 Feb 1999 16:57:20 -0000<br>Message-ID: &lt;918407071.27444.1.nnrp-12.9e98ce80@news.demon.co.uk&gt;<br>References: &lt;79fckc$jc2$1@news1.mts.net&gt; &lt;79fdke$1r8$1@remarQ.com&gt; &lt;79ijbq$njb$1@nnrp1.dejanews.com&gt; &lt;36BD1771.7835@infi.net&gt; &lt;918393784snz@genesis.demon.co.uk&gt;<p>Lawrence Kirby wrote in message &lt;918393784snz@genesis.demon.co.uk&gt;...&gt;Null pointers work perfectly well on platforms where "address 0" can<br>&gt;point to a valid object. However there is a reason for why a null pointer<br>&gt;should <em>compare</em> equal to zero and that is that tests like <TT>if&nbsp;()</TT><br>&gt;statements do the natural thing. Given that it makes sense for null<br>&gt;pointer constants to be defined in a consistent way.<p>The reason people find this confusing (and it's clear that lots of people<em>do</em> find it confusing; I remember being very confused myself a while ago)is, I think, that 0 changes in meaning depending on the situation in whichit's used.<p>Normally 0 means integer zero, but in some cases it means null pointer.It's natural to try to find a link between these and think of the nullpointer as pointing to address 0, but as the FAQ makes clear this isn't avalid approach.<p>We're all familiar with operators changing their meaning according tocontext (the - operator behaving quite differently with pointers than withnumbers, for example), but it's more surprising to see a constant actingthat way.<p>Cheers,<br>Richard</body><!-- Mirrored from c-faq.com/null/nullvs0.rs.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:59:50 GMT --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -