Is that applicable? His variable may be named ptr and it may ultimately be a pointer but he never uses it as a pointer in his C code; that is, he never dereferences it.
Is not the problem that unsigned int ppli = (unsigned int) ptr; is implementation-defined (in other words, may not work)? https://www.securecoding.cert.org/confluence/display/seccode/INT36-C.+Conver ting+a+pointer+to+integer+or+integer+to+pointer Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of David Crayford Sent: Thursday, March 27, 2014 3:34 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Compiler error in z/OS C compiler https://www.ibm.com/developerworks/community/blogs/5894415f-be62-4bc0-81c5-3 956e82276f3/entry/ab_use_of_the_ansi_c_aliasing_rules?lang=en > On 27 Mar 2014, at 11:51 pm, Bernd Oppolzer <bernd.oppol...@t-online.de> wrote: > > Hello mainframe C users, > > today I observed an error in the C compiler, which made me think again > about the optimization strategy of the z/OS C compiler. > > I wrote a small C function; the purpose was to translate pointer > values coming from PL/1 modules from NULL() values > - PL/1 builtin NULL() yields 0xFF000000 - to "real" NULLs > - 0x00000000 - or PL/1 SYSNULL. > > This is what I did: > > > /**********************************************************/ > /* */ > /* PLI/1 NULL () => SYSNULL () */ > /* */ > /**********************************************************/ > > static void *pli_null_to_sysnull (void *ptr) > > { > unsigned int ppli = (unsigned int) ptr; > > #ifdef COMPERR > printf ("Ausgabe in pli_null_to_sysnull " > "wg. Comp-Fehler: %x\n", ppli); #endif > > if (ppli == 0xff000000u) > { > return NULL; > } > else > { > return ptr; > } > } > > > the caller then did something like > > ptr = pli_null_to sysnull (ptr); > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN