Things that may be removed

bearophile bearophileHUGS at lycos.com
Tue Dec 23 19:23:05 PST 2008


Nick Sabalausky:
> Disagree. Octal can often useful on low-level embedded stuff.

I think the point was to improve the syntax of octal numbers, not to remove them. So 0125 becomes a syntax error (as usual to keep compatibility with C, otherwise it's better to make it just mean 125), and invent a less error-prone syntax for octal numbers. For example 0oxxxx.


> > * the comma operator (allow in selected places, eg for(; ;++a, ++b)).
> What is the problem with these?

Generally the comma operator is useful only in particular situations, and in other situations it may lead to errors.

This is an acceptable use (but this too may lead to some errors):
for( i = 0, j = MAX; i <= j; ++i, --j )

This shows some of the stupid uses of the comma operator:
http://stackoverflow.com/questions/54142/c-comma-operator

A way to use the comma operator is to allow multiple simultaneous assignments:
x, y = y, x
a, b, c = c, b, a
Etc.
(The compiler can minimize the operations and intermediate memory required to do that).

Bye,
bearophile



More information about the Digitalmars-d mailing list