Ah! (void *). I know what that means, but I am perhaps too dense to see what (void *)"" would accomplish. I "get" what it is doing -- casting a char* (or maybe a const char*) as a void* -- but other than for some obscure test I don't see the purpose.
Certainly open(NULL, ...) is a possible real-life mistake. You write a function that expects a passed file name; I call it thinking it is "smart" enough to know that a filename of NULL means don't use a file; you try to open what I pass. Too lazy to test and see what happens. I certainly agree that "bad address" is a lot more useful than "no such file." "Address is NULL" would be even more useful, to distinguish this special case from the case of some random garbage pointer. The programmer could look for "how might I be passing NULL?" as opposed to looking for "what might have corrupted that address?" There is so much HORRIBLE error diagnosis out there. I have been wrestling the past week with the Google App Store. Would not take an e-mail address on a particular page. Error message: "E-mail address is not valid." Huh? I get e-mail there. After hours of hacking it turned out to mean "that e-mail address is not associated with any gmail address." Another situation where it was rejecting an e-mail address, this time with the error "! Try reformatting". Well, gee, it was your basic e-mail format, [email protected]. No blanks or anything like that. Never did figure out what they wanted; got around the problem another way. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Paul Gilmartin Sent: Tuesday, March 1, 2022 9:48 AM To: [email protected] Subject: Re: ZAD and C/C++ (was:: 2.5 Heads Up) On Tue, 1 Mar 2022 08:46:35 -0800, Charles Mills wrote: > ..., but IBM *may* simply be following it. fopen(NULL, ...) is pretty > useless any way you slice it. > <https://en.wikipedia.org/wiki/Fuzzing> On Mac OS: printf ("%d\n", open( "", 0 ) ); -1 No such file or directory printf ("%d\n", open( NULL, 0 ) ); -1 Bad address I think both are optimal. OpenGroup doesn't specify the latter/ >I have no idea what (void I)"" would > Typo for (void *). Short finger? -- 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
