You can go through this link.... http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
On Sat, Aug 27, 2011 at 6:49 PM, john robin <[email protected]> wrote: > Hi, > > I've an interesting task. Given a c program say hi.c as input to a > program, the program should be able to return a file hi1.c such that > all dead codes are removed from the source code submitted. > > > refer link to know abt dead code > > http://en.wikipedia.org/wiki/Dead_code_elimination > > int main(void) { > int a = 5; > int b = 6; > int c; > c = a * (b >> 1); > if (0) { /* DEBUG */ > printf("%d\n", c); > } > return c; > } > > in the above snippet if(0){ } is dead code as it'll never be executed > so the output shld be > > > int main(void) { > int a = 5; > int b = 6; > int c; > c = a * (b >> 1); > return c; > } > > Any ideas as to how to solve this interesting problem ? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> "*Winners Don't do Different things , they do things Differently"* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
