On Thu, Mar 27, 2014 at 10:51 AM, 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)
>

I would replace the line above with:
    if ( (unsigned int)ppli == 0xff000000u) /* coerce ppli to an unsigned
int */


>    {
>       return NULL;
> }
>    else
>    {
>       return ptr;
>    }
> }
>

<snip>

-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to