× 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.



Hi Bruce,

There is a case where storage could inadvertently be overwritten but
it is only when a value is being returned that exceeds 16 bytes in
length.

Really? Can you explain that? That makes little sense to me. The system reserves 16 bytes for a return value, even if none is declared, you just can't exceed the 16 bytes???

That's a very weird (and not very intuitive, and not documented anywhere) thing.

I've had problems with undeclared return values before. If you resolve a routine via QleGetExp and call it without a return value (assuming the procedure declares a return value, but your prototype does not) I've had nasty problems. But, my return values might've been longer than 16 bytes, I don't remember anymore.

I'm assuming that RPG calling C would have the same problems. The RPG side doesn't know that the C procedure is going to return something, because it wasn't included in the prototype.

Note that this is a VERY different symptom from declaring a return value on the prototype and not using it. If it's declared on the prototype, RPG knows about it, and even if you don't use the return value, the compiler will handle it properly.


And any developer returning "something" longer than 16 bytes
by value (as opposed to a 16-byte pointer to the "something") should
have his or her hands slapped.

Then you have a LOT of hand slapping to do, my friend. It's a common practice in RPG. If you want to return a string from an RPG subprocedure and use it in an expression, you MUST declare it as a return value (which is by value). And more often than not, string values are longer than 16 bytes.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.