Jump to content
dormky

Why is there no RTTI for arrays ?

Recommended Posts

TMyRecord = record
	myArray: array [0..1] of Integer;
end;

The Delphi compiler seemingly does not generate runtime type information for "myArray". This seems strange, as :

TMyRecord = record
	myRecord: record
		myint: Integer;
	end;
end;

Here "myRecord" will get RTTI generated, with a name such as "TMyRecord:1".

TRttiArrayType exists to represent array types, but seemingly the decision was made to just... not use it ? What's the technical reason behind the refusal to generate RTTI for this case ? It seems everything is there to do it, and the compiler just... doesn't.

From an outside perpective, is seems it would be exceedingly easy to implement.

Share this post


Link to post

You have to declare the array type in order to use RTTI. RTTI only works on pre-defined types.

 

TMyArray = array[0..1] of Integer;

 

Edited by Leif Uneus

Share this post


Link to post

Yeah, it is a bit annoying though... We can't always change a 3rd party library that we want to inspect via rtti.  there are always workarounds... ;(

Edited by darnocian

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×