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



Yes, the compiler won't let you.
You'd probably have to call C, passing it a const char* and then copy it to
a local variable, then return that local variable as a pointer. Then in RPG
IV, call the C function to convert the const to a non-const. Then change the
data at that location... of course I don't know if that works. :)

If you're on pre-V5R1 you cannot take the address of a const parm at all.
Which is one of the reason testing for *OMIT on a CONST parm was a pain in
the a$$ on V4Rx.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of David Gibbs
Sent: Friday, September 02, 2005 10:33 PM
To: RPG programming on the AS400 / iSeries
Subject: Constants (was: *varsize array as procedure parameter)

Wilt, Charles wrote:
> Const == Constant Reference == pass a pointer to a variable and don't
> allow the contents of the variable to be changed.

Ok, this is something I've been curious about ... and maybe this is a
dumb question.

If a const is just a pointer to a variable that isn't allowed to be
changed ... is there any reason I couldn't take the address of that
pointer, assign it to another (non-const) variable, and change the
const's value that way?

david



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.