Re: Agree: Require ANSI C for development [Was: libwww ]

>Amen and Halleluia!

Wow!  Dan's religious streak has surfaced!

>Look at it this way: we've got different classes of consumers for
>libWWW:
>
>        * app developers: folks who just want to use the library to
>          build specialized apps. These folks shouldn't be required
>          to have an ANSI C compiler. If they can get a binary library
>          distribuition, the public header files should work
>          even on broken compilers.

I think they *should* be required to have an ANSI C compiler.  They
probably won't survive with just a binary distribution.  Besides, ansi2knr
converters are plentiful.  This not an important point, I just wanted
to disagree with something. :-)

>Not only should we require an ANSI C compiler for development, but we
>should write squeaky-clean ANSI C code, except for modules that need
>POSIX features, in which case we should write squeaky-clean POSIX code.

Amen!  Preach Brother!  I've been kind of fanatical in my libwww work about
making sure it compiles under Visual C's warning level 3 with no warnings.
Our hacked library also compiles under CodeWarrior on the Mac, which is kind of
shocking.  CodeWarrior gives compiler warnings if the programmer is sitting
with bad posture.

>For the non-standard interfaces (networking, etc.) we should use function
>pointers and allow folks to substitute work-alikes WITHOUT RECOMPILING
>THE LIBRARY!

Oh, I don't know that we need to go that far, but the spirit of your
stance is consistent with mine.

>For cases where the platform doesn't directly support ANSI C semantics,
>we supplement the runtime for that platform with something that does
>what the spec says. For example, in the case of malloc() causing memory
>leaks in MS Windows, we provide a malloc() that, for example registers an
>at_exit() function and free()s everything when the program exits.

Disagree.  Change the name of the function.  If I see malloc() in code,
I assume that it does the exact same thing ANSI says it does.  Nothing
more.  If I see W3_MALLOC in code, I assume that someone needed a malloc()
which did a little more than ANSI says it does, so they wrote one.  Since
that function name is all upper case, I also assume it's a preprocessor
macro, and that on some platforms, it may just define back to malloc().

>>Glad to get that off my chest.  If you agree to this, I'll be
>>back asking to re-indent the code with 4-space tabs! :-)
>
>I'm in favor of this too, by the way!

Good.  It's a movement that's gathering momentum. :-)


Eric W. Sink, Software Engineer --  eric@spyglass.com 217-355-6000 ext 237
All opinions expressed are mine, and may not be those of my employer.
        "Only academic people put cheese in their pocket."
            -SW, 24 May 1994

Received on Wednesday, 13 July 1994 21:23:24 UTC