--- layout: fc_discuss_archives title: Message 26 from Frama-C-discuss on May 2012 ---
Hello Boris, 2012/5/7 Boris Hollas <hollas at informatik.htw-dresden.de>: > I noticed that the parser transforms if-else-statements such as > > int f6(int x, int y) { > ?if((x == 0 && y == 0) || (x == 1 && y == 1)) return 1; > ?else return 0; > } > > into more complex if-else/goto-statements. Why is this done? This calls for two separate answers. First, the transformation into nested ifs is here to take into account the potential side-effects of the expressions and ensure that they will be evaluated (or not) according to the rules of the C standard regarding logical operators. Second, in the general case, this transformation would include the duplication of the original then and else branch (which can be pretty big) into an exponential number of blocks. gotos ensure that the size of the normalized code doesn't grow too much. Best regards, -- E tutto per oggi, a la prossima volta Virgile