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

📄 index.html

📁 this is a mirrored site c-faq. thought might need offline
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN"><!-- This collection of hypertext pages is Copyright 1995-2005 by Steve Summit. --><!-- Content from the book "C Programming FAQs: Frequently Asked Questions" --><!-- (Addison-Wesley, 1995, ISBN 0-201-84519-9) is made available here by --><!-- permission of the author and the publisher as a service to the community. --><!-- It is intended to complement the use of the published text --><!-- and is protected by international copyright laws. --><!-- The on-line content may be accessed freely for personal use --><!-- but may not be published or retransmitted without explicit permission. --><!-- --><!-- this page built Sat Dec 24 21:47:45 2005 by faqproc version 2.7 --><!-- from source file null.sgml dated Wed Dec 21 13:03:25 2005 --><!-- corresponding to FAQ list version 4.0 --><html><!-- Mirrored from c-faq.com/null/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:54:28 GMT --><head><meta name=GENERATOR content="faqproc"><title>Null Pointers</title></head><body bgcolor="#ffffff">&nbsp;<a href="../index-2.html"><img src="../images/buttontop.gif" alt="top/contents"></a><a href="../search.html"><img src="../images/buttonsrch.gif" alt="search"></a><hr><H1>5. Null Pointers</H1><p><a href="null1.html" rel=subdocument>5.1</a>What is this infamous null pointer, anyway?</p><p><a href="null2.html" rel=subdocument>5.2</a>How do I get a null pointer in my programs?</p><p><a href="ptrtest.html" rel=subdocument>5.3</a>Is the abbreviated pointer comparison ``<TT>if(p)</TT>'' to test fornon-null pointers valid?What if the internal representation for null pointers is nonzero?</p><p><a href="macro.html" rel=subdocument>5.4</a>What is <TT>NULL</TT> and how is itdefined?</p><p><a href="machnon0.html" rel=subdocument>5.5</a>How should <TT>NULL</TT> be defined on a machine which uses a nonzero bitpattern as the internal representation of a null pointer?</p><p><a href="safermacs.html" rel=subdocument>5.6</a>If <TT>NULL</TT> were defined asfollows:<pre>	#define NULL ((char *)0)</pre>wouldn't that make function calls which pass an uncast <TT>NULL</TT> work?</p><p><a href="long0.html" rel=subdocument>5.7</a>My vendor provides header files that <TT>#define</TT> <TT>NULL</TT> as <TT>0L</TT>.Why?</p><p><a href="fcnptr.html" rel=subdocument>5.8</a>Is <TT>NULL</TT> valid for pointers to functions?</p><p><a href="nullor0.html" rel=subdocument>5.9</a>If <TT>NULL</TT> and <TT>0</TT> are equivalentas null pointer constants,which should I use?</p><p><a href="macsochange.html" rel=subdocument>5.10</a>But wouldn't it be better to use <TT>NULL</TT>(rather than<TT>0</TT>),in case the value of <TT>NULL</TT> changes,perhaps on a machine with nonzero internal null pointers?</p><p><a href="nullreq.html" rel=subdocument>5.11</a>I once used a compiler that wouldn't work unless <TT>NULL</TT> wasused.</p><p><a href="nullptrmacro.html" rel=subdocument>5.12</a>I use the preprocessor macro<pre>#define Nullptr(type) (type *)0</pre>to help me build null pointers of the correct type.</p><p><a href="varieties.html" rel=subdocument>5.13</a>This is strange.<TT>NULL</TT> is guaranteed to be <TT>0</TT>, but the null pointer is not?</p><p><a href="confusion.html" rel=subdocument>5.14</a>Why is there so much confusion surrounding null pointers?Why do these questions come up so often?</p><p><a href="confused2.html" rel=subdocument>5.15</a>I'm confused.I just can't understand all this null pointer stuff.</p><p><a href="confusion4.html" rel=subdocument>5.16</a>Given all the confusion surrounding null pointers,wouldn't it be easier simplyto require them to be representedinternally by zeroes?</p><p><a href="machexamp.html" rel=subdocument>5.17</a>Seriously, have any actual machines really used nonzero nullpointers,or different representations for pointers to different types?</p><p><a href="runtime0.html" rel=subdocument>5.18</a>Is a run-time integral value of 0,cast to a pointer,guaranteed to be a null pointer?</p><p><a href="accessloc0.html" rel=subdocument>5.19</a>How can I accessan interrupt vectorlocated atthe machine's location 0?If I set a pointer to <TT>0</TT>,the compiler might translate it to some nonzero internal nullpointer value.</p><p><a href="nullpassign.html" rel=subdocument>5.20</a>What does a run-time ``null pointer assignment'' error mean?How can I track it down?</p><hr><p><a href="../index-2.html">top</a></p><p><a href="../questions.html"><img src="../images/buttontop.gif" alt="contents"></a><a href="../search.html"><img src="../images/buttonsrch.gif" alt="search"></a><br><a href="../about.html">about this FAQ list</a>&nbsp;<a href="../eskimo.html">about eskimo</a>&nbsp;<a href="../search.html">search</a>&nbsp;<a href="../feedback.html">feedback</a>&nbsp;<a href="copyright.html">copyright</a><p>Hosted by<a href="http://www.eskimo.com/"><img src="../../www.eskimo.com/img/link/eskitiny.gif" alt="Eskimo North"></a></p></body><!-- Mirrored from c-faq.com/null/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:54:37 GMT --></html>

⌨️ 快捷键说明

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