[SlimDX] Why is AvailableTextureMemory signed?
I guess this is just a minor question of style, but is there a specific reason that SlimDX.Direct3D9.Device.AvailableTextureMemory is of a signed instead of an unsigned type? (The API it's based on, IDirect3DDevice9::GetAvailableTextureMem, is of type UINT and in practice can return values larger than 2147483647.)
Unsigned types aren't really part of the underlying type system and so not all languages can consume them correctly (in theory). Why they didn't force them as part of the spec, I don't know exactly, but basically you can't be a CLS compliant assembly if you expose unsigned stuff. We try to stick to the rules where possible and let clients convert to unsigned as necessary.
Unsigned types are not part of the CLS, because the CLS was designed to be as broadly applicable as possible, and not all languages have support for unsigned types. In theory languages that do have them could represent them differently, but I don't think that's a huge concern since actual types consumed by the underlying runtime are not necessarily the same types as those exposed by the runtime (CIL only understands 32 and 64 bit integers, "native" (e.g., unspecified) format floats and unsigned values, object references, and references to within an object, et cetera.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement