Well, let's see... while((*--o=*--i)!=92)while(92!=*--o=*--i) It's quite important that assignment have more priority, for simple expressions as "bool x = a != b" to work. By the standards, (...).
Forget what I was going to say, I just think I figured it out. Yeah, != has bigger precedence, but look what you did: it is on the left side of the expression, so it wouldn't be a valid syntax that way. :) Probably GCC just skips this syntax, and I'm not sure if the second option (seeing the *--o = *--i as the right side) is invalid in an ANSI application, but TCC's accepting it would be like an "extension", ain't it? I think this couldn't be seem as a bug... but yeah, probably this is worth a compiler warning. Sorry for the last reply, my answer didn't much make sense... I've read it quickly from my cellphone, didn't pay much attention. > From: [email protected] > To: [email protected] > Date: Thu, 12 Apr 2012 15:44:13 +0100 > Subject: Re: [Tinycc-devel] Small curiosity, re operator precedence. > > I think the pre/post -- bit is ok though, not got a problem with that. What > seems wrong is that TCC looks like it's giving the assignment priority over > the comparison, and according to Wikipedia, the comparison sould have WAY > more priority (9 on list, with assignment right down at 16 on list). It's not > the location of the incrementor that matters, I think, but the assignment of > the dereferenced value itself. It clearly works after the decrement as > desired, and I like the way TCC works, it's just that it appears to be wrong, > and I want clarification. As it is, I can't do this with GCC, which acts in > accordance with what Wikipedia says about this... > > It seems to go beyond interpretations and implemetations of equal precedence, > when one is as different from the other as 9 is from 16. > > > Paulo Henrique Torrens <[email protected]> wrote: > (12/04/2012 14:42) > > >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. :) > > > > > >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 > > > _______________________________________________ > 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
