Why do shift operators undergo integral promotion?

so so at so.xn--s-fka
Tue Aug 9 14:44:00 PDT 2011


On Wed, 10 Aug 2011 00:08:02 +0300, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> There's no reason to have a separate version of the language which is  
> more
> compatible with C than another version. It would just complicate things.

> Not
> only would it be a burden on the compiler maintainers, but then you  
> would have
> to know whether code was intended to be compiled with the standard D  
> compiler
> or with the one which is more compatible with C. It would be a mess for  
> very
> little benefit.

I see having a compiler flag is a bad idea, it would be entirely in the  
source code.
It is not about having more/less compatible compilers. There is only one  
compiler to be maintained and it is D.
Getting rid of such a restriction (C compatibility) would be priceless i  
can't express, and i don't understand why it is not obvious.
Our problem is this very restriction. D should be called "C like (easy to  
learn if you know C/C++) and supports C natively", not "C compatible".  
Because if being out of date was the only thing wrong about C then someone  
would just add some modern features and call it maybe... C++-+%?

> The question here is whether we can safely make the change to D's  
> behavior
> without breaking code which is ported from C or C++. As long as it is  
> pretty
> much a guarantee that any code which relies on the C behavior is buggy,  
> then I
> don't see any reason why we can't fix the behavior in D. However, if  
> there are
> valid reasons for C code to rely on the C behavior, then we're kind of  
> stuck.
>> From what I can see though, it sure looks like any C code which relies  
>> on the
> C behavior would be buggy.

We are falling a trap C didn't. How is it any different than maintaining  
ASM compatibility in C? But they didn't, they just separated it.
They had a very compelling argument, so much more important than ours,  
that ASM is THE machine itself. Yet they just dropped it.

c code:
....
asm {
  ....
}

and d would be better of like:

...
asm {
...
}

...
C {
}


More information about the Digitalmars-d mailing list