comp.lang.ada
 help / color / mirror / Atom feed
* Detect arithmetic operator usage for user-defined integer type
@ 2020-04-16 10:07 gautier_niouzes
  2020-04-16 10:38 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: gautier_niouzes @ 2020-04-16 10:07 UTC (permalink / 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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-16 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 10:07 Detect arithmetic operator usage for user-defined integer type gautier_niouzes
2020-04-16 10:38 ` Dmitry A. Kazakov
2020-04-16 18:42   ` gautier_niouzes

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