It’s been about 30 years but I seem to remember the compiler taking care of this for me (in Ada) with types.