Re: [LIP] Undefined behaviour ?
"Anirban Biswas." <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday 29 Oct 2003 13:20, Mithun Bhattacharya wrote:
> -----------------
> #include <stdio.h>
> main() {
> int i = 4;
> /* int j = i+++++i+i+++++i; */
> /* int j = i++ + ++i + i++ + ++i ; */
> int j = (i++)+(++i)+(i++)+(++i);
> printf("%d\n", j);
> }
> -----------------
>
> The above peice of code has three initialization of j out of which only
> the last two works with gcc 3.2.2
Hi
man are you crazy or following the stupid book written by Kanitkar in which
he deals with these kinds of shits. Man , I became sick just reading the
first page of the problems in C or somthing like that by Kanitkar.
Follow the golden rule KISS , Keep It Simple Stupid as the other ppl said the
above shit is compiler dependent & since it is crazy to use it for real
coding purpose in my view there is no real reasons to spend time with the
above piece of code.
Now if it is needed for some job interview or something like that ask the so
called C Guru of your class who wrote 1000 of C program but can not write a
program for real problems . I am sure he will know the ans.
Anirban Biswas.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/