Am 05.07.2019 um 22:34 schrieb J. Gareth Moreton:

It feels like a very convoluted way to implement a safe means of reading an enumeration from a file, but given that that reading incorrect data files is one of the main causes of enums taking on invalid values, I have to say that this is the best solution should we not be allowed the "is" operator or an intrinsic.  If that is the case, then I propose this gets added to TStream!

At least it hides the gruesome details, cause you only need to call ReadEnum<> (or ReadRange<>)... And maybe the code the compiler generates can even be optimized further. :)

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to