This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).
We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:
Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,
Post an idea.
Get feedback from the IBM team and other customers to refine your idea.
Follow the idea through the IBM Ideas process.
Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.
IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.
ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.
IBM will use this request as input to planning but no commitment is made or implied. This request will be updated in the future if IBM implements it. IBM will use votes and comments from others in the community to help prioritize this request.
This feature would most likely be implemented as a new value for the DCLOPT keyword, such as DCLOPT(*NOIMPLICIT). It would apply to other implicit declarations (the parameters for the COMMIT and DEVID file definition keywords).
We're thinking that if we implement this item, it would probably be a new option for the DCLOPT Control keyword rather than a new value for the OPTION parameter and OPTION keyword.
Mark, if there were some new option to prevent the compiler from implicitly defining a BASED pointer, I think it would probably not even be allowed to define a local variable based on a global pointer.
The compiler can't start using a global pointer if the local pointer is not defined.
But even aside from the issue I mentioned, there's also the issue Niels mentioned, where the programmer mistypes the pointer for the BASED keyword.
I see the issue, but how would an option correct this particular problem? by causing a compile time error? At least the programmer would know that the global pointer wouldn't be automatically attached as the basing pointer. I'm torn between yea and nay on this one. In general I don't like globals, but they do have a limited place. Maybe a better way to handle this is if you would just use the global if it were defined as a pointer. That is really what most people would expect since the basing pointer need not create a new pointer. Or maybe implicit definitions should always use a like defined global if one exists. They use a like defined local if one exists and even error out if the like named local is defined differently. We are getting into some complicated name resolution routines here.
In case anyone is not aware of the issue here, RPG implicitly defines a pointer if it is used with the BASED keyword. This can cause unexpected behaviour if you use the BASED keyword in a procedure expecting the variable to be based on a global pointer. Instead, the compiler defines a local pointer.
dcl-s g_ptr pointer;
dcl-s storage char(10);
g_ptr = %addr(storage);
p1();
return;
dcl-proc p1;
dcl-s based_fld char(10) based(g_ptr); // A local g_ptr will be implicitly defined by the compiler
dsply based_fld; // error, pointer not set
end-proc;
@NielsLiisberg not that type of declarations, only to prevent run time errors when you declare something like:
Dcl-s CodeList like(code) dim(10) based(p_CodeList);
Dcl-s x_CodeList pointer inz(%addr(CodeFields));
Note x_ and p_
Can you elaborate on this: Do you think about strongly types pointers like in C / C++ . for example "pointer to int"