-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRttiInfo.DynArrayItemSize get 0 when no elType is present #82
Comments
This function does what it is documented to do: " get the dynamic array type information of the stored item" What do you want to achieve? Please use the forum to discuss this. |
program Project1; {$APPTYPE CONSOLE} {$R *.res} uses type var sz := FXLocArrTyp.DynArrayItemSize; FXLocArrTyp.DynArrayItemType(sz); WriteLn('You can see, something is wrong!'); |
I guess you are using Delphi, not FPC? |
yes delphi 10.3.3 |
Should be fixed now. Thanks for the feedback. But anyway, you should better use TRttiCustom and its properties, e.g. Cache.ItemSize, rather than those lower level functions. |
function TRttiInfo.DynArrayItemSize: PtrInt;
begin
if DynArrayItemType(result) = nil then
result := 0; --> this is an error !!! Item size is independent of elType
end;
function TRttiInfo.DynArrayItemType(out aDataSize: PtrInt): PRttiInfo;
begin
with GetTypeData(@self)^ do
begin
aDataSize := elSize;
result := pointer(elType); //elType is nil if type does not require cleanup
if result <> nil then
result := PPointer(result)^;
end;
end;
The text was updated successfully, but these errors were encountered: