Usually compilers do the job of dead code elimination during optimizations.
Gcc does that during compilation.

On Sun, Aug 28, 2011 at 1:34 AM, rajeev bharshetty <[email protected]>wrote:

> 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"*
>
>


-- 
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.

Reply via email to