On 27 June 2013 18:32, Stéphane Ducasse <[email protected]> wrote: > > On Jun 2 >> >> Yes, you right. >> (NBFFICallout new resolveType: 'byte*') valueSize => 1 >> (NBFFICallout new resolveType: 'byte*') storageSize => 4 >> >> apparently, if one wants array with 'byte*' element type (or any other) >> it should use a pointer size (4), not byte size (1) for it. >> >>> Or is a disclaimer not to use the class for, say, 'char*' elements more >>> appropriate? >>> >> no , it should be fine. >> The difference between valueSize and storageSize is a bit confusing, >> and easy to confuse which to use.. >> Perhaps they need different naming. > +1 consider that people will use that during 10 years so good comments + > names is KEY > yes, i always in such mode. But sometimes a right term/word/concept comes after number of interations (until you, as developer finally really understand what you just did or what you actually wanted to do ;)
>> There also stackSize, which means "how many bytes a value of given type >> will take, if pushed on stack , and aligned accordingly" >> >> ... after some more investigation, i found that actually >> storageSize should not be used. There is typeSize instead. >> >> So, the final expression should be: >> >> elementType := aTypeName. >> elementSize := (NBFFICallout new requestor: self; resolveType: >> elementType) typeSize. >> >> >> and #sizeOf: method should also use typeSize apparently. >> >> >>> Cheers, >>> Henry >> >> >> -- >> Best regards, >> Igor Stasenko. >> > > -- Best regards, Igor Stasenko.
