What should be added to C
Frank Adams
franka at mmintl.UUCP
Sat May 31 00:02:40 AEST 1986
In article <450 at cad.BERKELEY.EDU> faustus at cad.UUCP writes:
[Concerning andif]
>I think this looks cleaner, but in any case it isn't an often-encountered
>situation and the semantics aren't obvious.
There is no disputing matters of taste. I find it is an often-encountered
situation, and that the semantics are obvious.
>You can write arbitrarily large macros by putting backslashes at the end of
>lines. This is ugly but it works.
This doesn't let you use "#if" in the body of the macro, as my example would
require. To fully explicate, my example would be:
#begdef copy(to, from, number)
#if sizeof(from) % WORD_SIZE == 0
copyword(to, from, number * sizeof(from) / WORD_SIZE)
#else
strncpy(to, from, number * sizeof(from))
#endif
#enddef
> > Confusing "=" and "==" in if statements is a common mistake. If "=" is not
> > a legal operator, this error becomes very rare.
>
>It's also an extra character to type. If you are prone to this sort of
>error, just run your code through grep if | grep = | grep -v == ...
Thanks but no thanks. If one added a separate step to the compilation
process for each type of relatively common error, nothing would ever get
done. Again, please note that I did not propose outlawing "=" as a
default -- you would have to specify an option to exclude it.
> > This is the whole point of having a standard. It gives you some assurance
> > that compilers which use the features will be available.
>
>If the standard has all the things you enumerate, not many people will follow
>it and it will be worse than no standard at all.
This is not consistent with the experience in promulgating standards for
other languages. FORTRAN 77 differs from the old standard rather more than
the relatively modest set of changes I proposed; it has been widely adopted,
essentially all new FORTRAN compilers adhere to the standard, and such
compilers have been made available for most machines still in use on which
an older compiler is available.
Again, I want to emphasize that my proposals are not things to be included
in the current standard (X3J11), but the next one. It is both too late to
include changes of this magnitude in that standard, and inappropriate to
make this kind of change in the initial standardization of the language.
Frank Adams ihnp4!philabs!pwa-b!mmintl!franka
Multimate International 52 Oakland Ave North E. Hartford, CT 06108
More information about the Comp.lang.c
mailing list