| www.delorie.com/archives/browse.cgi | search |
| From: | "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: printf bug ??? |
| Date: | Fri, 5 Jun 1998 14:43:45 -0700 |
| Organization: | Hewlett-Packard, Roseville |
| Lines: | 13 |
| Message-ID: | <6l9oqf$q6m$1@rosenews.rose.hp.com> |
| References: | <35784752 DOT B7BF8C31 AT hamburg DOT netsurf DOT de> |
| NNTP-Posting-Host: | ros51675cra.rose.hp.com |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
> printf("%d %d %d", i, i++, i++);
This looks suspiciously like a troll, but I will bite since it appears he
tried it on two different compilers and one was DJGPP/gcc.
>Using DJGPP I got the output "3 2 1" which is wrong.
No its not. Read the C language faq. There is a whole section on sequence
points and where you are allowed to make changes to lvalues and stuff. The
gist is that your code is illegal, and the compiler can do anything it likes
with it.
Andy
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |