Function call with constant parameter

Hello,

I'm wondering if there is any sense using significantly different constant parameters when calling a function with slightly altered purpose?

For example:

const uint8_t PARAM_1 = 0;
const uint8_t PARAM_2 = 1;

void doSomething(const uint8_t param)
{
  //do something common first
  
  //do something based on param
  if (PARAM_1 == param)
  {
    //something_1;
  }
  else if (PARAM_2 == param)
  {
    //something_2;
  }
  else
  {
    //something went wrong, do safe stuff
  }
}

Would it be better if e.g.:

const uint8_t PARAM_1 = 111;
const uint8_t PARAM_1 = 222;

Is there any importance of PARAM_1 PARAM_2 Hamming distance?

Thanks in advance.

No. The Hamming distance has no relevance in determining whether the values match or not.

It is used to detect and possibly help correct a stream of received data, which is not what is happening here

Okay, Hamming distance expression is not appropriate here.

But if parameters are:

const uint8_t PARAM_1 = 0;
const uint8_t PARAM_2 = 1;

Only one bit memory/copy/whatever error is enough and PARAM_1 could become PARAM_2 or vica versa. However if they are different in more, than one bit, then the possibility that one becomes the other decreases and the "safe stuff" could be done. Is this make any sense or I have way too much free capacities? :smiley:

No. Are you worried that the value of a const variable will be changed by an outside even such as the chip being hit by a cosmic ray ?

That would fit in the "whatever" error category. :slight_smile:

If there's more than a vanishingly small chance of memory contents being randomly changed (without you doing something wrong like writing passed an array boundary), then there's no hope of your program working at all. Give it up now.

This is straightforward. And relieving. Thank you.