views:

51

answers:

1

I tried to use astyle to format the code base I've to work with. When I use the option --add-brackets the executable is not identical (If I only use -t and/or -b the output is identical).

if(a) return b

is modified to

if(a)
{
     return b
}

So my question is. Does gcc generate the same output if I only add and/or delete braces (obviously only for one liners like above). I tried some simple test case but already got an bit identical executable.

+4  A: 

1, No

2, Use the - s flag to see the assembler ( or http://stackoverflow.com/questions/1289881/using-gcc-to-produce-readable-assembly to get more readable assembler)

Martin Beckett
Thanks to hits hint, I was able to find the problem. There was macro in the source which was using `__LINE__` as internal value. When astyle adds braces, obviously `__LINE__` may change as well and therefore the compiled output.
azraiyl