|
Darren, Sorry, I did not clearly read your message in regards to the VALUE, CONST and pointers. I reread the manual and I know see your confusion between the two in regards to pointers. Both states that the value passed will not be modified from the caller's point of view. I think the difference is that VALUE passes the pointer address and that the caller will not return a different pointer address, but it still allows you to modify memory. Since, CONST has the authority to create a temporary variable (or pointer) passing a pointer via a pointer is... well... pointless. You would be modifying a different memory location that will then be discarded after the call. SO, CONST says make the caller's value read only and allow them to pass any similar sized value to this parameter and the compiler will make up the difference by padding. It can create a temporary variable at compile time since it can identify the size of the variable/constant being passed. If the variable being passed is exactly the same, then I think it just uses the address of that variable. Also, you need to consider the read only aspect. Why would you want the compiler to allow you to have the possibility to modify read only memory? This is how I understand pointers in the context of VALUE and CONST. Thank you, Matt Tyler WinCo Foods, LLC -----Original Message----- From: rpg400-l-bounces+mattt=wincofoods.com@xxxxxxxxxxxx [mailto:rpg400-l-bounces+mattt=wincofoods.com@xxxxxxxxxxxx] On Behalf Of darren@xxxxxxxxx Sent: Friday, January 27, 2006 8:39 AM To: RPG programming on the AS400 / iSeries Subject: RE: CONST vs. VALUE on a pointer parameter I'm familiar with the basic differences between CONST and VALUE. I read this information when writing my application and I inferred that the actual passing mechanics were the same between VALUE and CONST, except that CONST should not be changed by the calling program. I can't see that this information clarifies why a call to an API would fail as mine did using CONST for an INPUT only variable(pointer). Did I miss something? "Tyler, Matt" <mattt@wincofoods .com> To Sent by: "RPG programming on the AS400 / rpg400-l-bounces@ iSeries" <rpg400-l@xxxxxxxxxxxx> midrange.com cc Fax to 01/27/2006 10:20 AM Subject RE: CONST vs. VALUE on a pointer parameter Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> Darren, First read the Book "WebSphere(r) Development Studio: ILE RPG Programmer's Guide" found here, http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c0925074.pdf or http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/sc0925 07.pdf . See Pages starting 135. Thank you, Matt Tyler WinCo Foods, LLC -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.