Jump to content

Index Array Function does not return default values for Type Definitions


mje

Recommended Posts

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

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.