home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: gnu@toad.com (John Gilmore)
-
- [ This originallly appeared in comp.std.c. However, I think some of
- the points John is tryring to make are valid criticisms applicable
- to POSIX as well as ANSI C. Most followup's should probably go
- to comp.std.c; however, it is entirely possible to make comments
- relevent to this group, so I've not put in a Followup-To: line.
- Please use your judgement -- mod ]
-
- It seems to me that the ANSI C committee overstepped the boundaries of
- `prior art', producing scores of needless incompatabilities. And they
- plan to do it again soon.
-
- My company works on a compiler. This compiler runs on a large variety
- of host systems. It cannot control the include files on those host
- systems. The ANSI C `model' was of a unified compiler and include
- files and libraries. Unfortunately, the market does not fit that
- model. We have to interoperate with the host-supplied include files
- and libraries.
-
- We now have a 640-line shell script that fixes up the include files on
- a bunch of these host systems. The problems we run into are utterly
- trivial. The question of whether memcpy returns a char * or a void *.
- Whether the abort function `returns' int or void, even though it
- doesn't return. Whether arguments to stdio functions include the const
- qualifier. Each of these is an issue on a different host system.
- There is no prayer of getting more than a hundred compilers to agree on
- all these fiddly details. Neither the compiler writer, nor the library
- author, nor the user cares one whit about this stuff. But because of
- ANSI C, we are all stuck with trying to make it consistent. Because if
- we don't, our programs don't compile, due to conflicting declarations.
- Because of ANSI C.
-
- It's been possible to write portable programs for a long time. Once
- ANSI C appeared, it became harder to write portable programs. It is
- infected with the "I'm the only variant of C in existence" disease even
- worse than most vendors' C implementations. And the Committee felt
- free to change all sorts of things (like the types in the above
- paragraph), without regard for the impact it has on users. Vendors, at
- least, have to stay compatible with other major vendors; the Sun-1
- compiler had to compile 'most anything you could throw at a Vax, or Sun
- wouldn't have survived. The ANSI C committee seems to be more
- insulated from the results of its decisions. This needs changing.
-
- In a portable program, how can I declare `abort'? Old compilers don't
- have <stdlib.h>, so I can't just include that, or I'll get a
- compile-time error. Some old compilers consider it void, others
- consider it int. At link time nobody will care, so I could just
- explicitly declare it either way. But if for some reason <stdlib.h>
- *does* get included, perhaps through a host-dependent config file, and
- you declared it backwards from the way <stdlib.h> declared it, your
- program won't compile. On SunOS 4.1.1, which is a non-ANSI system,
- <stdlib.h> declares abort `extern int abort (/* void */);'. (Non-ANSI
- systems are free to do things like this. It doesn't violate any
- standards.) The solution we adopted is to declare abort in the host-
- dependent configuration file. It is *one more thing* that we have to
- configure on a host-by-host basis. Our program is more complicated,
- harder to understand, and harder to port. Because of ANSI C.
-
- The answer `Just wait til everything is ANSI C' is a symptom of
- infection with the aforementioned disease. What if we want to write
- programs *now*? Also, the ANSI C committee wants to start revising the
- C standard again. So even if you waited til everything was ANSI C,
- there will soon be two of them, and you'll be back fiddling with
- bullshit details just to get working programs to compile.
-
- They've started by changing the paragraph numbering just to get us
- warmed up. And they're throwing away the Rationale because too many
- people could follow the deliberations. Obscure prescriptions in the
- third person are always easier to defend than `We did it this way
- because ... '.
-
- Now they want to `track' what some ISO committee is doing to C. We
- already suffered the first abortion produced thereby -- trigraphs. The
- next plan is to rewrite all the multi-byte character functions. We
- clearly didn't have enough practical experience with them (if they need
- changing so soon), and they don't belong in the standard anyway. So
- let's change 'em, and force all the vendors to supply the new ones!
-
- Somehow the Committee has the idea that if a good idea doesn't make it
- into the standard, it won't be adopted, and that if a bad idea makes it
- into the standard, it doesn't matter anyway; it can be changed later.
-
- I'll tell them what matters. What matters is stability. We have all
- the turmoil and all the good ideas we need without their help.
- Standards exist to create stability. I'd be glad to throw the ANSI C
- committee a retirement party, if they won't ever meet again for the
- next ten years. I'm serious.
- --
- John Gilmore {sun,uunet,pyramid}!hoptoad!gnu gnu@toad.com gnu@cygnus.com
- "It isn't given to us to know those rare moments when people
- are wide open and the lightest touch can wither or heal."
-
-
- Volume-Number: Volume 28, Number 7
-
-