comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Detect arithmetic operator usage for user-defined integer type
Date: Thu, 16 Apr 2020 03:07:51 -0700 (PDT)
Date: 2020-04-16T03:07:51-07:00	[thread overview]
Message-ID: <8afdbc7f-7089-437e-8be9-9abdb9a94a46@googlegroups.com> (raw)

In a project I'm reworking, there is a type

  type Opcode is range 0 .. 79;

associated with values:

  k_Load_Address                  : constant := 0;
  k_Push_Value                    : constant := 1;
  ...

I'd like to define Opcode as an enumerated type:

  type Opcode is (k_Load_Address, k_Push_Value, ...);

The problem is that there are, in some places in the legacy code, arithmetic operations on Opcode values (ouch!). Is there a tool able to list those operations for the custom type Opcode, other than defining Opcode as enumerated and let the compiler find the arithmetic operations to be removed? Probably it's what I'll do ultimately, but maybe such a detection could be useful in another context.

TIA
_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 

             reply	other threads:[~2020-04-16 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 10:07 gautier_niouzes [this message]
2020-04-16 10:38 ` Detect arithmetic operator usage for user-defined integer type Dmitry A. Kazakov
2020-04-16 18:42   ` gautier_niouzes
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox