Thanks. I should have clarified that the LRM says that the argument of new[] is non-negative, implying that 0 is legal. I can also see that new[0] might be useful where the argument to new[] is the result of some expression, possibly a parameter, similar to the way a zero replication constant is very useful. If you are correct that it should read "If the dimension currently does not exist," then that phrase will need to be explained within the LRM, because it will not otherwise be clear enough. Thanks, Shalom ________________________________ From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich, Dave Sent: Tuesday, November 08, 2005 5:33 PM To: Bresticker, Shalom; sv-ec@eda.org Subject: [sv-ec] RE: [sv-bc] 5.6, 22.6: Dynamic Arrays questions Yes, this question currently belongs in the sv-ec. (I would be totally in favor of collapsing the two groups into one errata group) I agree with you that new[0] could be the same as delete, but I could also see users wanting it to be an error and requiring them to use an explicit delete. Other opinions? In 22.6, I believe it should read "If the dimension currently does not exist" This would be the case in a multi-dimensional array if a higher order dimension is out of range and the second order dimension is queried. For example: int A[$][$];// assume no elements have been added or int A[2][2]; then $size(A[2]) should return 'x For the queue, if I do A={ {}, {}, {} }; Then $size(A[2]) should return 0 Dave ________________________________ From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Bresticker, Shalom Sent: Tuesday, November 08, 2005 6:19 AM To: sv-bc@eda.org Subject: [sv-bc] 5.6, 22.6: Dynamic Arrays questions Does the following belong to sv-ec? In a dynamic array, is it legal to give new[0] ? Does it do the obvious, emptying the array, like delete()? Second, regarding size() and $size: 5.6.2 says that size() "returns the current size of a dynamic array, or zero if the array has not been created." and "The size dynamic array method is equivalent to $size(addr,1) array query system function (see 22.6)." 22.6 says that "When used on a dynamic array ..., these functions return information about the current state of the array. If the dimension is currently empty, these functions shall return a 'x." So, on an empty dynamic array, what do size() and $size return? Thanks, Shalom Shalom Bresticker Intel Jerusalem LAD DA +972 2 589-6852
This archive was generated by hypermail 2.1.8 : Tue Nov 08 2005 - 07:44:04 PST