Restricting ++ and --

d-noob doesnt at exist.com
Sun Oct 25 05:43:14 PDT 2009


bearophile Wrote:

> d-noob:
> 
> >That would break C compatibility and sounds ridiculous.<
> 
> It breaks C compatibility, but it doesn't assign a new meaning to a C syntax, it just disallows a syntax used in C, and this is allowed by D philosophy.
> 
> Many of the things I say sound ridiculous :-)
> You may say it's not a handy change and you may refuse it, but I think it's not a ridiculous idea because those changes lead to code that's equal to how some expert coders suggest to program to avoid bugs, this is one of them, but I have seen two more:
> http://users.bestweb.net/~ctips/tip037.html
> So it's a language enforcement of a coding tip/standard.

Might be so. I don't personally like C code like
  int c;
  c = (c++), (--c), (++c);

But there has to be a middle ground. Lately there has been many attempts at removing C like parts of the grammar, but that will harm D in the long run. Once the C/C++ crowd realizes how good D is, they will only convert if there is a safe syntactical path.



More information about the Digitalmars-d mailing list