if I have a record type like this:
type ABC is record
A : Integer;
B : Integer;
end record;
How could I create a subtype of ABC with two Integer types whose range are specified?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
While not answering your question per se (as NWS says, you can’t do that), if instead of A and B being integers, they were to be arrays, you can do the following:
The A and B record fields then utilize the index subtype as provided by the record discriminants.
This is a nice trick I’ve used from time to time, useful when reading in variable length strings from an interface (such as a socket) where the number of bytes to read is supplied via fixed-sized header; or in the case of a variant record with an enumeration discriminant, I can subtype the record to a specific variant.