I see what you are asking. You are probably quoting the standard correctly. I am speaking as a practical programmer, not as a standards writer:
- It is guaranteed to be consistent. If you pass me nullptr and I compare what you pass to nullptr it will always compare equal, even if your code was compiled differently from mine. - It is never the address of any actual C "thing." There is no risk that you pass me the address of some C "thing" and it turns out coincidentally to be logically equal to nullptr. (Yes, if you pass me the address of the PSA that logic will fail. I would say the PSA is not a "C thing.") - It is in fact 0 on the three C's I care about: MS, gcc and xlc (and probably Clang) -- and I am going to guess most other C's. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Seymour J Metz Sent: Tuesday, March 1, 2022 10:09 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: ZAD and C/C++ (was:: 2.5 Heads Up) Is nullptr an address of 0, or is it an address guarantied to not be valid? "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." -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Charles Mills [charl...@mcn.org] Sent: Tuesday, March 1, 2022 11:46 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: ZAD and C/C++ (was:: 2.5 Heads Up) C is a standardized language. IBM's main target market is programs ported from other platforms. I have no idea what the standard is, but IBM *may* simply be following it. fopen(NULL, ...) is pretty useless any way you slice it. I have no idea what (void I)"" would mean and I don't *think* it is valid C. A quick test of auto foo = (void I)""; gives me a bunch of errors. NULL is nothing special in C: it is just an alias for 0 (zero). That lead to a somewhat astonishing behavior in a particular situation involving overloaded functions, and the new (C++ only? Perhaps C also) language standards include nullptr, which is specifically an *address* of zero, and is a better usage than NULL if the meaning is "the address of nothing." That is, "you are expecting me to pass you an address and I am telling you that I have no address to give you." Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Paul Gilmartin Sent: Tuesday, March 1, 2022 8:30 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: ZAD and C/C++ (was:: 2.5 Heads Up) On Tue, 1 Mar 2022 13:28:01 +0000, wrote: ><snip> >ZAD is not supported on z/OS under z/VM. " :-( >Is there any SOD or RFE or the like for this? ></snip> > Many releases ago, I saw a report the C RTL treatment of following a NULL pointer was changing. I tested open( NULL, ... ) with releases before and after the change. The earlier reported Invalid Pointer; the later Invalid Filename. I considered the earlier more precise and correct. I conjecture that IBM had fecklessly accommodated programmers accustomed to misusing NULL instead of e.g. (void I)"". There are probably still programs that follow null pointers. What will become of them? I favor strict error reporting. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN