I once had lust in my heart for the PEDANT license plate in the NSF garage. 
And, yes, some of these "minor" pedantic difference do have major practical 
consequences.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List [[email protected]] on behalf of 
Paul Gilmartin [[email protected]]
Sent: Tuesday, March 1, 2022 1:42 PM
To: [email protected]
Subject: Re: ZAD and C/C++ (was:: 2.5 Heads Up)

On Tue, 1 Mar 2022 18:09:14 +0000, Seymour J Metz wrote:

>Is nullptr an address of 0, or is it an address guarantied to not be valid?
>
Ah, pedantry!  It depends on whether "invalid" is equivalent to "unequal
to a pointer to any object ..." (or whether one implies the other.). The
statement below does not constrain the storage representation of NULL
(as in type-punning).  I believe the behavior of "if ( NULL ) ..." (specified
elsewhere) requires that (intt) NULL be zero.

Cases to consider:
o a putative pointer to the interior of a multi-byte object
o an arbitrary int value cast to (void *)
o a pointer to a free()ed object.

>�An integer constant expression with the value 0, or such an expression cast 
>to type void *, is called a null pointer constant. If a null pointer constant 
>is converted to a pointer type, the resulting pointer, called a null pointer, 
>is guaranteed to compare unequal to a pointer to any object or function.�

--
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to