This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Integral conversions in C/C++


Andrew Haley wrote:

That was the whole point of the OP (Did you read the subject ?).

Unfortunately I did. yes.

Yet you keep going. Why ?


The operands, and the result, are all of type unsigned int, which
presumably is 32 bits in this case.

And given that integral promotions according to [conv.prom] only promote as far as to unsigned int as the type with the highest conversion rank, where was there intergal promotion applied, again ?

So what? The compiler does what the standard says it must.

Which was the actual incentive for the OP. There are more reasons to it but those are even more confusing to the general readership of this ML. Given that this is gcc-help@gcc.gnu.org and the history of GCC having, for example, introduced a number of their own _extensions_ (most notably appearing in the Linux kernel code first) that, now bear with me, actually made it into the C standard because people actually realized after many years how useful these features were, it was the rational location to introduce/discuss the topic at hand. The amount of stirr-up that eventually ensued was interesting from a psychological aspect but disappointing intellectually.

Right: the compiler can use such an instruction, but it must discard
the upper part of the result.

And _here_ is where the standard screws up. Given that there exists actually an architecture _implementing_ such an insn, the idea of it can't be too esoterical, or can it ? Again, common laws are changed all the time and so can standards if indeed people understood the value of and naturally the need for change. The latter is purely algebraically motivated while the former usually depends on factors that only marginally have something to do with rationality as the type of the responses have clearly shown.

"The correct result"?  The correct result is whatever the standard
says it is.

However counter-intuitive to anyone knowing what linear algebra is it may possibly seem. That's also olds.

Right, so it sounds as though you do understand the standard.

I do actually understand a lot more than that. What gave it away ? Is it my pointing to the actual standards text and the insinstence on doing so for the responders to prove their arguments ?

What, then, is your point?

All in the above.



Cheers, Christian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]