[fpc-devel] [Suggestion] Enumeration range-check intrinsic

Kai Burghardt wiz at KaiBurghardt.de
Sun Jul 14 18:33:22 CEST 2019


Nihao,

On Sat, Jul 13, 2019 at 01:52:46PM +0200, Michael Van Canneyt wrote:
> On Sat, 13 Jul 2019, Jonas Maebe wrote:
> > On 13/07/2019 13:28, J. Gareth Moreton wrote:
> > [...]
> > 
> > Declare your enumation types so that the lowest and highest valid value
> > comprise the lowest and highest value representable by its storage:
> > 
> > {$mode delphi}
> > {$z1}
> > type
> >  tmyenum = (ea, eb, ec, emax = 255);
> > 
> > That behaves the same both in FPC and in Delphi.
> 
> This is a completely pointless definition, since for effective use you still
> need to add code to check that the value is a named one.

Not to mention, that this is the job of the {$PACKENUM} directive,
ensuring an enumeration type reserves a minimum amount of space.
-- 
Sincerely yours
Kai Burghardt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 912 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190714/4bc10ac4/attachment.sig>


More information about the fpc-devel mailing list