On Nov 14, 2024 at 8:11:53 PM, Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Because it wasn't deemed necessary that the compiler itself provides this
> operator.
>

You can use it to create ordinal types from bytes using a generic. I was
trying to do something like this. If you do other operations on constants
it makes to include powers too. Of course you can solve this a number of
other ways too but I preferred this one.

type
  SomeInt<const A, B: Byte> = record
    header: 0..(256**A) - 1;
    footer: 0..(256**B) - 1;
  end;

SomeInt<4, 3>

Regards,
    Ryan Joseph
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to