How to define a type like size_t?? #39372
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-ffi
JavaScriptCore has a API is
JSStringGetLength
it need a JSStringRef and return asize_t
type value.size_t : if the compiler is 32 bit then it is simply a typedef(i.e., alias) for unsigned int but if the compiler is 64 bit then it would be a typedef for unsigned long long. The size_t data type is never negative.
dart.ffi has ffi.Uint32, ffi.Uint64, witch type should I use to map size_t? If I use ffi.Uint64 it has a out of bound problem is 32bit machine. I think this problem because in 32bit matchine C API return a 32bit size value, but ffi.Pointer it will find UInt64 size value. If I use Uint32 in 64bit matchine when the return value is so large may be out of bound.
How to define a type in 32bit matchine is Uint32 and 64bit is Uint64 like size_t??
The text was updated successfully, but these errors were encountered: