mje Posted April 1, 2009 Report Share Posted April 1, 2009 QUOTE (Index Array Function Documentation) If the index is out of range (<0 or >=N, where N is the size of n-dimension array), element or subarray returns the default value of the defined data type for the array. The behavior of the function deviates from this documentation when dealing with type definitions, as the attached example shows. It demonstrates a typedef based off an I32, which defines a default value of -1. The function instead returns an element with a value of 0, the default for the I32, not the typedef that's in use. The behavior is the same for both type definitions and strict type definitions. If the behavior is intended, I think the documentation is unclear. Download File:post-11742-1238511295.zip Quote Link to comment
Aristos Queue Posted April 1, 2009 Report Share Posted April 1, 2009 QUOTE (MJE @ Mar 31 2009, 10:00 AM) If the behavior is intended, I think the documentation is unclear. Actually, what's unclear is the meaning of "typedef". :-(Yes, this is intended behavior. Any default value you set in a typedef control applies *only* to a control. The type definition is not defining a type of data, it is defining a type of a control. The data type -- for the purposes of determining default value at runtime, as, for example, the value of an output tunnel of a For Loop that executes zero times -- is the type without the typedef. The typedef is really only meaningful when talking about how it displays on the front panel or if the data type underlying the typedef changes, for the purposes of block diagram constants. Quote Link to comment
mje Posted April 1, 2009 Author Report Share Posted April 1, 2009 I had a feeling that might be the case, it's a little disappointing Thanks, AQ. Quote Link to comment
Aristos Queue Posted April 1, 2009 Report Share Posted April 1, 2009 QUOTE (MJE @ Mar 31 2009, 12:33 PM) I had a feeling that might be the case, it's a little disappointing If you actually want to define a new data type, would a LabVIEW class work for you? You can define a meaningful default value for those that has the behavior you're looking for. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.