3 ms·
>Back in 1990, on the other hand, you wanted to strangle a language that made you ripple a domain change of 0..255 to 0..65535 through all the code by hand. EVE
by Lucretia9 6y ago
>Back in 1990, on the other hand, you wanted to strangle a language that made you ripple a domain change of 0..255 to 0..65535 through all the code by hand. EVERYWHERE.
If you're using hard coded constants instead of actual constants, you deserve the pain of changing it everywhere.
Something_Lower : constant := 0;
Something_Higher : constant := 255;
type Something is range Something_Lower .. Something_Higher;
Is how you do it. Changing the higher value to 65535 or anything else won't ripple.
Now, you do that in C, you've got hardcoded magic numbers all over the place and the compiler would've just silently compiled without warning. Have fund debugging that mess.
- kqr 6y agoOr type Something is range 0 .. 255; And now Something'First equals 0, and Something'Last equals 255, or whatever upper bound you chose. There is no reason to hard code a magic constant for the upper end of the range anywhere.