Is the behavior of Array.new() and/or Memory.alloc() defined for a size of zero?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is the behavior of Array.new() and/or Memory.alloc() defined for a size of zero?

WBahn
Administrator
I can't find any place that describes the expected behavior under these conditions, but the StringTest program creates a zero-length string (even though I can't find any place other than here that says that zero-length strings have to be supported -- but I might easily have missed it).

As near as I can tell, the built-in Array.new() function invokes some very strange behavior.

If the behavior of these two functions is not defined, then it should be so indicated in the specifications for the OS functions.
Reply | Threaded
Open this post in threaded view
|

Re: Is the behavior of Array.new() and/or Memory.alloc() defined for a size of zero?

WBahn
Administrator
In looking over the list of error codes (which aren't the easiest thing to find, by the way), the implication is that arrays and allocated memory blocks must be strictly positive (the error code only says positive, but other error codes use the term non-negative which implies that "positive" should be interpretted as "strictly positive").