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<const U:byte> = record
                list: array[0..U-1] of integer; // ERROR: high value < low 
value (0..-1)
        end;


There’s a couple ways to resolve this:

1) Add some extra flags to nodes/syms so “U-1” can be known to contain a 
generic parameter and errors can be ignored. That’s the most complicated 
solution and I wasn’t able to figure that out easily because flags need to be 
transferred in multiple locations.

2) The easy solution is to add another tdef member to tconstsym which can be 
used for range checking in generics and let the tconstsym.typedef def be 
undefined like it used to be (which fixes the above bug and perhaps others). 
This means another def needs to be added to the PPU write/read system though.

3) Be lazy and don’t do range checking. :)

Any idea about this?

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to