This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

would like to use #if

   if ((&x - &y)  != 1889)  // 1889 IS FIXED NUMBER do not change
   {                 // do not bypass/change, see comments above
      while (1)      // do not bypass/change, see comments above
      {              // do not bypass/change, see comments above
      PING_WDOGS();  // do not bypass/change, see comments above
      }              // do not bypass/change, see comments above
   }                 // do not bypass/change, see comments above

for various reasons the dfference between &x and &y must stay what it is or "unanticipated" errors that may pass a test will occur.

I hate to 'hang' whoever makes the illegal change and would thus prefer
#if ((&x - &y) != 1889)
#error : illegal change
#endif

is thare a way to circumvent the preprocessors objections?

Erik

Parents
  • Not too fun with a construct where address of two variables have to have fixed distance.

    It's slightly more common to have structures where fields are expected to be at a specific offset (but still quite hurtful).

    Could you possibly share reason for your requirement? I would be interesteed in seeing if there might have existed some other language or design construct for the original problem.

Reply
  • Not too fun with a construct where address of two variables have to have fixed distance.

    It's slightly more common to have structures where fields are expected to be at a specific offset (but still quite hurtful).

    Could you possibly share reason for your requirement? I would be interesteed in seeing if there might have existed some other language or design construct for the original problem.

Children
No data