C: Convert A ? B : C into if (A) B else C

Posted by tur1ng on Stack Overflow See other posts from Stack Overflow or by tur1ng
Published on 2010-03-11T18:24:43Z Indexed on 2010/03/11 18:29 UTC
Read the original article Hit count: 138

Filed under:
|
|
|

I was looking for a tool that can convert C code expressions for the form:

a = (A) ? B : C;

into the 'default' syntax with if/else statements:

if (A)
  a = B
else
  a = C

Does someone know a tool that's capable to do such a transformation?

I work with GCC 4.4.2 and create a preprocessed file with -E but do not want such structures in it.

© Stack Overflow or respective owner

Related posts about c

    Related posts about if-statement