[SlimDX] Why is AvailableTextureMemory signed?

Started by
2 comments, last by samv 15 years, 3 months ago
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.)
___________________________Buggrit, millennium hand and shrimp!
Advertisement
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
Oh, I guess that makes sense. Too bad.

Thanks anyway!
___________________________Buggrit, millennium hand and shrimp!

This topic is closed to new replies.

Advertisement