II.18: What is the benefit of using const for declaring constants?
-
Answer:
The benefit of using the const keyword is that the compiler might be able
to make optimizations based on the knowledge that the value of the variabl...
Tuesday, June 23, 2009
How should NULL be #defined on a machine which uses a nonzero bit pattern as the internal representation of a null pointer?
Programmers should never need to know the internal representation(s) of null pointers, because they are normally taken care of by the compiler. If a machine uses a nonzero bit pattern for null pointers, it is the compiler's responsibility to generate it when the programmer requests, by writing "0" or "NULL," a null pointer. Therefore, #defining NULL as 0 on a machine for which internal null pointers are nonzero is as valid as on any other, because the compiler must (and can) still generate the machine's correct null pointers in response to unadorned 0's seen in pointer contexts.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment