Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
That would be compiler dependent. Compiling n=n+1 as an increment instruction is one of the rudimentary optimizations, as is using a shift for a multiplication by a power of 2 and ignoring do nothing statements ( n=n+0 or n=n*1)
Some compilers have switches to control the degree of optimazation.
Compilers also usually have switches to generate an assembly listing of the code they generate. Reading this listing can be a real eye opening experience.