[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] TypedArray constructors and zero length

----- "Cedric Vivier" <cedricv@neonux.com> wrote:

> Hi,
> Currently TypedArrays spec does not define behavior when zero or a
> negative value is passed as length of a constructor.
> I guess we should specify the behavior, I propose following addition
> to the spec of all constructors with a 'length' argument :
> """
> If length is zero or negative, an INDEX_SIZE_ERR exception is raised.
> """
> Negative might be unnecessary though since type is "unsigned long",
> does this mean a negative value should raise a TYPE_ERR if I
> understand WebIDL correctly ?

0 is a valid length; you should be able to create 0-length arrays as necessary, otherwise there's no way to represent a valid empty array.  You'd have to pass null, which means special casing everything that works with arrays to understand null.

And as the length is already unsigned, then it can't ever be negative, so I don't think we need to do any special language here.

    - Vlad
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: