This is a "feature". Ansi C says that the post and preincrements order are implementation defined. As it seems, there is something about the precedence order of the ==, that problably is some optimization. In order to achieve portability, separe it in some lines with the right order. But, yeah, that's no bug. :)
-----Original Message----- From: Lostgallifreyan Sent: 12 Apr 2012 13:15:19 GMT To: [email protected] Subject: Re: [Tinycc-devel] Small curiosity, re operator precedence. Lostgallifreyan <[email protected]> wrote: (31/03/2012 09:47) >Please ignore any 'unsafe' aspect this example might have, it IS bounded in >the context I'm using it in.... > >while((*--o=*--i)!=92) > >I was tryign to reduce stuff, so came up with this to try: > >while(92!=*--o=*--i) > >TCC loves it, GCC hates it. :) > >GCC thinks it's doing this: while((92!=*--o)=*--i) and therefore an invalid >lvalue, which makes sense given what Wikipedia has to say about precedence, >but TCC (still using v0.9.24 here) seems to do what I was wondering if it >might do, to compare the dereferenced value when it is copied. I reverted to >the original form because the more compilers take my code the happier I am >about it, but I'm interested. Is this a bug, or a feature? :) > Rudolph Loew, maker of the 48 bit LBA patch for W98, amongst other things, says this: It does appear to be a bug as far as I can tell. They should not be reinterpreting the precedence even if the intent can be inferred. I'm losing my limited power to code, I think my brain is dying. Not kidding. Not a coding problem so I'll say no more about it other than this: I cannot be trusted to fix the code, even if I try, especially as I don't know enough about TCC, and this needs to be looked at by someone working on TCC! You have a choice of two base assumptions: Rudolph Loew's brain is also dying, or there is a problem you need to check out. _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
