[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More info, Re: HTTPAPI EXAMPLE1 blows up on V4R4 box.



James,

> More weirdness: It seems that "eval pos = %scan('?': path)" works fine 
> without the "-1", and "eval pos = 0 - 1" works fine. But put the two 
> together, and it's like putting hypergolic rocket propellants together: 
> boom.

My best guess is that the V4 level compilers incorrectly assume that the
intermediate result is an unsigned number. It's true that the output of 
the %scan() BIF is an unsigned number, but when you subtract 1 from it, 
the intermediate result SHOULD be a signed number (and it is in V5). I 
can only guess that this is a bug in the older compilers that IBM fixed 
before V5R1 was released.

In the following message, Nick Radich claims that the problem does not 
exist on V4R5:
http://archive.midrange.com/rpg400-l/200802/msg00162.html

Anyway, an easy workaround is to split the expression into two lines so 
that the compiler determines the intermediate results differently:

       c                   eval      pos = %scan('?': path)
       c                   eval      pos = pos - 1

I'm going to change my copy of HTTPAPI to use this code so that it will 
be done this way in future betas and releases.  Please change yours as 
well to verify that it fixes the problem (there's no way I can test it, 
since I can't reproduce the problem.)

Thanks
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------