Why do shift operators undergo integral promotion?
so
so at so.xn--s-fka
Tue Aug 9 16:29:26 PDT 2011
On Wed, 10 Aug 2011 01:36:58 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> ??? One of the rules of language design that Walter has stuck to
> throughout
> the development of D is that if you take any C or C++ code and try to
> compile
> it as D code, it will either fail to compile, or it will compile with
> the same
> behavior as the code would have had in C or C++. This is so that you
> don't
> silently introduce bugs when porting code from C or C++ to D.
I like Walter's ideas on language design and his analysis on other
languages, this is not one of them. I don't understand what purpose it
does serve.
> There's _lots_ of stuff in D that isn't valid C code, and there's plenty
> of
> stuff in C which isn't valid D code. Saying that C/C++ code must either
> be
> valid D code with the same behavior or not compile is not particularly
> restrictive on the whole.
You are missing the point. You'd be right if D being C like was a strange
consequence (we did everything as it should be done, did not repeat other
languages mistakes, funny enough a C code compiles like it is a D code)
rather than the result of some restriction (which would have only one
outcome) in design.
> It's really only an issue with some arithmetic
> stuff. D is free to add additional restrictions (such as requiring casts
> for
> narrowing conversions), and it can do whatever it wants which is
> different
> from C as long as it isn't valid C - and almost everything that D does is
> different enough that it's almost a non-issue.
Free to add but on what criteria?
> You'd actually probably have a hard time trying to come up with a
> feature to
> introduce to the language which would be valid C but have different
> behavior
> in D than C. The common stuff is the really basic stuff like arithmetic
> and
> pointers, which isn't really where you're going to be adding features.
Funny enough it wouldn't be that hard find, my first appearance in this
list was exactly on this issue.
Remember there was no templates in C, and C numerics was designed for that
environment which is far from D.
Separation would be great help but i am afraid it is getting late for D.
We know the consensus for major changes, especially at this stage.
More information about the Digitalmars-d
mailing list