× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On 27/10/2009, at 1:22 AM, Scott Klement wrote:

There's a difference specifically in the way 1-byte return values are
passed. When ILE was implemented, C and CL passed them one way,

Yes, I'd forgotten that. I now recall (see the archives) saying on some earlier occasion that CL made the wrong decision on that behaviour. I think it's more that C widens return values and CL chose to assume the same behaviour from all called procedures rather than the more natural alternative.

and RPG
and Cobol chose to pass them differently. (I think C and CL pass them
as an integer, and RPG and Cobol pass them as character strings... and
there's some sort of a difference in the mechanism somewhere deep under
the covers.)

Unfortunately, I don't know exactly what that difference is.

however, I believe *CNOWIDEN tells RPG to use the same convention that C
(and CL) use for 1 character return values.

Yes, I guess that's the trick. *CNOWIDEN changes RPG behaviour to accommodate C although doesn't that actually seem counter-intuitive? I mean if you specify nothing then RPG doesn't widen but the return value is messed up. If you specify *CWIDEN then RPG widens and the return value is OK. If you specify *CNOWIDEN then RPG doesn't widen but the return value is still OK. Sounds like a side-effect to me--or special case.

I guess my real complaint is with C not providing a way to control widening of return values. Ah, well no amount of complaining will correct that situation but at least I can see what RPG is attempting by use of *CNOWIDEN. I still have to work around the behaviour but that's OK.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.