0

Previously I was using Borland compiler for my project and currently switched to Paradigm compiler.

I came across a peculiar situation. I have a piece of code which has no effect during execution. This no-use code behaves/causes no issue when compiled in Borland, but causes some register corruption when compiled from Paradigm. Following is the code block.

if (VarA == TRUE)
{
    //No code - for future implementation.
}

Once the IF case passes it will execute code inside the case, unfortunately that block will be implemented in future, so no code inside that.

Will Paradigm compiler really cause/corrupt any problem for this situation ? or Paradigm is doing some optimisation during compilation ?

-- VP

  • 1
    Most probably due to adjacent code. If `VarA` is uninitialised then it's technically undefined behaviour. But only a truly nasty compiler would cause register corruption in that case. – Bathsheba Apr 10 '14 at 10:10
  • VarA is assigned with some value and used for some comparisons above the mentioned code block. Interesting point is, when I comment this block or keep some code like mentioned below, then it is not causing any issue. if (VarA == TRUE) { VarA = 20; } (or) #if 0 if (VarA == TRUE) { //No code - for future implementation. } #endif – user3518530 Apr 11 '14 at 05:35

0 Answers0