Hairy Pixels via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am Mo., 25. Apr. 2022, 10:58:
> > > > On Apr 25, 2022, at 2:39 PM, Martin Frb via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > Actually, it's dealing with SmallInt (or ShortInt). And if the > programmer does not know that, then it might be an issue... > > > > Imagine the generic code (something more complex than "Add") would > somehow do something that differs for SmallInt and Integer. Like using > "SizeOf(T)". > > This is almost a case that requires better type restrictions. If your > generic function relies specifically on some particular type information > this is almost not really even a good candidate to be generic at all. > Then you don't think creative enough. Think about (de)serialization code for binary data which needs to use the correct size. If done correctly this can very well be handled with a generic. Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal