From: geest3+@pitt.edu (Gregg E Economou)
Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA *
Date: 1998/08/29 [thread overview]
Message-ID: <6s9m0h$i1g$1@usenet01.srv.cis.pitt.edu> (raw)
In-Reply-To: 6s910k$2bo$1@Starbase.NeoSoft.COM
why must people consistently fault the tool for what really ought to be
blamed (if they think it is so terrible) on those _using_ the tool.
First of all, you might see less of these poor unrobust programs from
other languages not because it is more difficult to write bad programs
in other languages, but perhaps because other languages arent useful enough
to do what they needed to do. perhaps? maybe? think about it.
No i do not want to start a language war.
Next issue: for the last and final time, neither the standard library,
nor the run-time init/exit routines, nor command arguments, nor strings,
are part of C. They have been bundled with it (implemented for one's
respective operating envionrment) in _most_ instances of a C compiler,
for a long time now, and as a matter of convention and according to ANSI
are part of a C development environment. however they are NOT part of the
actual language! how hard is it for people to understand this?
Because of the existing convention that the commonly encountered need for
some text to be handled primarily for purposes of i/o, that the location
and size of this text be identified as beginning at some known location
and ending at the next instance of a null, current and future support
for this method of handling a 'string' will exist. Humans are creatures
of habit. But there is no such thing as a string in C. There is no such
thing as a command line argument in C, or a command line. All those
things are conventions dictated by the design of various operating
systems which poeple commonly deal with, and with what facilities the
designers of various hardware environments chose to provide the user with,
and the authors of C comilers subsequently designed their product around.
Libraries, including the 'standard' library, are merely archives of
precompiled object code. Their headers are merely declarations so that
the linker can handle them and that the compiler can allocate necessary
accomodations for them. The librariesin C are written in C, they are not
part of C. end of story! i cant believe i am still explaining this to
people!
Other languages which do enforce strict type checking, bounds checking,
control of this and that and the other thing, and have all kinds of anal
hierarchies, have their advantages of 'safety' and 'integrity' but like
all such 'safetey' nets, they do so by restricting, hindering, or outright
prohibiting the user from certain sets of operations which on the underlying
machine are perfectly legal. This in my humble opinion constitutes a
reduction in the utility of the system by reducing the size of the set
of things i have at my disposal as services of the hardware to perform
the work i want done, and forces me to use a smaller set of rigidly defined
services that someone else thought were a nice thing to have. My
requirements and goals are not one and the same wiht whoever else came along,
and consequently i will be forced, if i wish to use a rigid and strongly
typed language, to beat my problem into the right shape for the mold
instead of beat the machine into the shape for my problem. That in a
nutshell is why C has its advantages. Certainly for people who are
afraid of making a mistake they can go use some other language and
i hope they enjoy it- but dont start accusing C of things that have little
or nothign to do with C!!
In article <6s910k$2bo$1@Starbase.NeoSoft.COM>,
Jordan Henderson <jordan@Starbase.NeoSoft.COM> wrote:
>
>I remembered that after posting that the compiler does in fact have
>support for a 'nul-terminated string' in it's string constants. There's
>another place as well, command line arguments are supported as nul-terminated
>strings.
neither of those are such because of any underlying requirement in C.
Read the source code to your compiler. You will see that the support
for 'null terminated strings' was an arbitrary decision and could just
as easily been done in some other fashion had people wished it.
in fact, there are on some systems libraries with routines already made
for convenience of handling counted strings.
>
>I won't argue the fine semantic point of C not having a nul-terminated
>string 'data type', it's pointless. I will argue that nul-terminated
>strings are a 'feature' of the language, which is what the original
>poster was saying (that they weren't).
um, no, the original poster flamed C out for having this dependence on
null-terminated strings. Then myself and several other gentlemen countered
with the information that that was an arbitrary convention among
programmers and had nothing to do with C itself. Then this whole thing
started :)
>
>In some languages, it might be useful to separate the "language" from the
>standard library. Not in C. For example, any of the standard library
>functions can be implemented >by the compiler< as in-line calls. The
implemented by the compiler? um, do you know what youre talking about?
the libraries are just a bunch of somebody else's code that has been
written for you, for your convenience, which you glue into your
program through essentially concatenation of object code and linking of
jump addresses.
>compiler can know about the standard library in very intimate ways.
um, no, not really necessary. Yeah, some implementationsof the standard
library have been optimized through extensive inlining, but hell most
compilers will udnerstand some macro or preprocessor directive to pass
inline code to the assembler as well so you can do that yourself should you
so wish. this does not change the fact that the library is not part of
the language.
>
>If you want to try and separate the standard library from the language,
>you could still point to the fact that the string constant and command
>line arguments are nul-terminated, ON ALL CONFORMING IMPLEMENTATIONS.
conforming to what? implementations of what? of the library?
if you just separated the library form the language (ignoring for
a moment the fact that they arend bound to begin with), then you musnt
mean that. what else is there? run-time init code and exit/return
code? thats specific to the operating system. but it isnt
part of or specific to C.
>This is not just a 'convention'. Without jumping through absurd
>contortions, every C programmer will have to deal with nul-terminated
>strings at one time or another. Noone, except PERHAPS in some odd
>embedded application that has no command line args and avoids string
>constants for some ROM initialiization reason, who programs in C can
>avoid them.
so really you are complaining that many operating systems deal with
null-terminated strings by convention and you're forced to handle this
too. Well, here is some news: if you were to write a fortran or pascal
program under such an environment, all those command line and
environment items would if they were to appear as some more structured
'string' types, been converted by some code that ran as part of the
runtime init that was generated by the linker on your OS. your
orgram, though you yourself might not see it, would still be dealing
with them :)
>
>Without getting mired in pointless debate about what constitutes a 'data type'
>and where do we draw the line between standard library and 'language' and
>what do we call them, I'd like to say that I think that nul-terminated
>strings most certainly are a feature of C, and always have been.
um, no. weve been trying to explain that its not, and show why it has
been so commonly misconstrued as such as a result of common practice.
>
>The original discussion was about how this feature of C leads to
>dangerous programming practices. Since, as I believe, you can't
>avoid nul-terminated strings in the real world, I would then go
>on to claim that C forces upon you practices that are can lead to
>non-robust programs, more so than other languages. I recognize
youre really on thin ice here. If is so choose i can just as easily write
crap in any language I choose, be it C, pascal, ada, cobol, or english.
The language does not force you to write crap. If you have personal
difficulty in handling null-terminated strings and thus wish to fault
the language, which is innocent of the whoel matter, thats your (misguided)
perrogative, we're all free people here.
>the trade-offs, the convenience that you get with C. It's still
>the only language that's in wide use that will allow you to write
>SO much of an OS kernel in it. It may be a good way to avoid
>assembly language.
>
>I think the relative unreliability of applications written in C
What are you talking about? unless you have a flaky compiler, your
programs will not be unreliable merely because theyre written in C!
they will be unreliable if you have not thought your algorithm through
and have therefore written an incorrect program. Then you have only
yourself to fault, and blaming the language is simply immature and
ridiculous.
>has SOMETHING to do with 'features' of the system. Sure, you
>could write C without command line arguments, without string
>constants and without using the standard library, but you
speak for yourself. When fancy takes me to, or my requirements dictate that
i do, i do :)
>wouldn't. Same for pointer arithmetic, a useful feature, but
>too easily abused and leading to unrobust programs.
thats only if you as the programmer are incapable of properly using
the tool. Is a screwdriver to be faulted if a mechanic puts a door on
backwards?
happy hacking,
gregg
next prev parent reply other threads:[~1998-08-29 4:00 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0095000017115526000002L062*@MHS>
[not found] ` <35E04DF1.1911@world.std.com>
[not found] ` <35E09E76.6773@earthlink.net>
1998-08-23 4:00 ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Terry C. Shannon
1998-08-23 4:00 ` Glenn C. Everhart
1998-08-24 4:00 ` Paul Sture
1998-08-25 4:00 ` Gregg E Economou
1998-08-25 4:00 ` John Wilson
1998-08-26 4:00 ` Gregg E Economou
1998-08-27 4:00 ` John Wilson
1998-08-25 4:00 ` Jordan Henderson
1998-08-26 4:00 ` Bob Koehler
[not found] ` <6s910k$2bo$1@Starbase.NeoSoft.COM>
[not found] ` <35e833be.0@news.wizvax.net>
1998-08-29 4:00 ` Jordan Henderson
1998-08-30 4:00 ` Gregg E Economou
1998-08-30 4:00 ` K&R fight over ketchup (was: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA ) Clint Comes
1998-08-31 4:00 ` Bob Koehler
1998-09-05 4:00 ` Gregg E Economou
1998-08-30 4:00 ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * John Wilson
1998-08-30 4:00 ` JF Mezei
1998-08-30 4:00 ` Chris Torek
1998-08-31 4:00 ` Gregg E Economou
1998-08-31 4:00 ` Chris Torek
1998-08-30 4:00 ` Lawrence Kirby
1998-08-30 4:00 ` JF Mezei
1998-08-30 4:00 ` Martin Ambuhl
1998-08-31 4:00 ` Craig Franck
1998-08-30 4:00 ` JF Mezei
1998-08-31 4:00 ` firewind
[not found] ` <6scur7$qtk@bgtnsc02.wo <35EA0E22.C59E9476@videotron.ca>
1998-08-31 4:00 ` Will Rose
1998-08-31 4:00 ` Michael Rubenstein
1998-09-04 4:00 ` Thor Lancelot Simon
1998-09-05 4:00 ` Peter da Silva
1998-09-05 4:00 ` Jordan Henderson
1998-09-07 4:00 ` Peter da Silva
1998-09-07 4:00 ` Jordan Henderson
1998-09-07 4:00 ` Richard Stamp
1998-09-07 4:00 ` Dan Pop
1998-09-07 4:00 ` Peter da Silva
1998-09-07 4:00 ` Jordan Henderson
1998-09-08 4:00 ` Peter da Silva
[not found] ` <6t2im5$mke@espresso.cafe.net>
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` Tim Shoppa
[not found] ` <6t4cui$hfu@espresso.cafe.net>
1998-09-09 4:00 ` Tim Shoppa
1998-09-08 4:00 ` JF Mezei
1998-09-09 4:00 ` Dan Pop
1998-09-09 4:00 ` Peter da Silva
1998-09-08 4:00 ` JF Mezei
1998-09-08 4:00 ` Dan Pop
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` Dan Pop
1998-08-29 4:00 ` Gregg E Economou [this message]
1998-08-30 4:00 ` Jay Maynard
1998-08-26 4:00 ` Paul Sture
1998-08-27 4:00 ` Gregg E Economou
1998-08-28 4:00 ` Paul Sture
1998-08-26 4:00 ` Bob Koehler
1998-08-27 4:00 ` Thor Lancelot Simon
1998-08-28 4:00 ` TERENCE MURPHY
1998-08-28 4:00 ` Monty Brandenberg
1998-08-28 4:00 ` Greg Thomas
1998-08-29 4:00 ` mathog
1998-09-01 4:00 ` Greg Thomas
1998-08-28 4:00 ` George Cornelius
1998-08-29 4:00 ` Gregg E Economou
1998-09-05 4:00 ` Peter da Silva
1998-08-28 4:00 ` Bob Koehler
1998-09-05 4:00 ` Peter da Silva
1998-09-08 4:00 ` Carl Perkins
1998-08-31 4:00 ` Boris
1998-08-27 4:00 ` Peter da Silva
1998-08-31 4:00 ` Boris
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox