Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Ryan Joseph
Yesterday I discovered I wasn’t doing proper range checking for ordinal constants so for example, a generic with “const U: byte” could be specialized as <1000>. We want ordinal constants to respect range checks right? I made a little utility function which works in most cases but I don’t think

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Jonas Maebe
On 08/01/19 17:34, Ryan Joseph wrote: I made a little utility function which works in most cases but I don’t think it’s correct and more importantly this function probably already exists in the compiler. function compare_orddef_by_range(param1,param2:torddef): boolean; var

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Ryan Joseph
I’ve made constants respect their proper definition now so we can do range checking but this broke some other things. For example there’s a range check error with static arrays now because “U” has a value of 0 so 0-1 = -1: type generic TList = record list: array[0..U-1] o

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Sven Barth via fpc-pascal
Am Di., 8. Jan. 2019, 21:01 hat Ryan Joseph geschrieben: > I’ve made constants respect their proper definition now so we can do range > checking but this broke some other things. For example there’s a range > check error with static arrays now because “U” has a value of 0 so 0-1 = -1: > > type >

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Benito van der Zander
Hi, that reminds me of https://bugs.freepascal.org/view.php?id=34232 Bye, Benito Am 08.01.19 um 23:28 schrieb Sven Barth via fpc-pascal: Am Di., 8. Jan. 2019, 21:01 hat Ryan Joseph mailto:r...@thealchemistguild.com>> geschrieben: I’ve made constants respect their proper definition now

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Sven Barth via fpc-pascal
Am Di., 8. Jan. 2019, 23:49 hat Benito van der Zander geschrieben: > Hi, > > that reminds me of https://bugs.freepascal.org/view.php?id=34232 > Yes, that falls into the same category... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepa