On Jun 2, 2017, at 2:00 PM,Chip Scheide wrote:

> Maybe I am too ambitious...
> 
> (from Host)
> 
> Build_Table_Arrays(->$Table_Names_array;->$Table_num_array;->$Table_Pointer_array)
> This call would build 1D arrays with the (respectively) table names 
> (formatted for users), Table numbers, and pointers to the tables.
> 
> The 'trick' is that I want to allow a slightly different call to the 
> same component method
> 
> Build_Table_Arrays(->$Struct_Names_array;->$Struct_num_array;->$Struct_Pointer_array)
> Where $Struct_xxxx is a 2D array which will contain not only Table, but 
> also field information; so the resulting arrays would contain 
> (respectively) ALL table and field names (formatted for the users), ALL 
> Table and Field numbers, and pointers to ALL tables and Fields.
> 
> And this is where the dereferencing a pointer to a 2D array, sub-array 
> access problem is occurring, inside the component method and it's 
> internal method calls for parameter validation (my post on Type issue), 
> and for resizing the sub-array(s) for field information (this post).
> 
> <Irony on>  
> *Of course* 
> </Irony off> 
> the methods in the component that do type validation, and array 
> resizing ALL require pointers as parameters, because these methods are 
> themselves ALSO exposed as part of the Utility component package I am 
> trying to create....   :)
> 
> ... and now my head hurts again...

Here’s a crazy idea. Just provide 2 methods instead of 1 and skip all the 
parameter type validation. 

Build_Table_Arrays(->$Table_Names_array;->$Table_num_array;->$Table_Pointer_array)
Build_Struct_Arrays(->$Struct_Names_array;->$Struct_num_array;->$Struct_Pointer_array)

Then there is no need to test for the array type pointer. As an intelligent 
programmer you will always use the correct method name depending on if you are 
passing a 1D array pointer or a 2D array pointer. Right? :)

Problem solved. Workaround found. Life continues on. Head will no longer hurt. 

I totally understand if this has now become a quest to master a nuisance of the 
4D language regarding pointers. It’s a tricky area for sure when dealing with 
2D arrays. Sure it’s always best to "validate the hell out of” all parameters. 
But sometimes the answer is to just not ask the question. Like the old saying 
“Doctor it hurts when I move my arm this way.” And the doctor replies “well, 
don’t move your arm that way”. :)

Tim

********************************************
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com
********************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to