In another previous message, you displayed a lack of affection for C++.
Yet
this is the classic argument of why C++ supersedes C. Your string
equality
overloading has been done to death in countless C++ examples (perhaps
even
more than "hello world") and is implemented in C++ libraries with the
"String" Class.
If you are indeed a perfectionist in readability, and if you indeed
believe that using
strcmp(), strcpy() and other operator-like functions hurts the
readability of your code,
then you can either write function wrappers (in C) for these functions
(which I don't
advocate, because you are abstracting common calls that programmers
should be
familiar with) or you can use a different language.
If you are comfortable in C, why not just write C-style code while
exploiting the rich
libraries of C++ for high-level objects (Strings, Vectors, Containers,
Hash Tables....)?
I think that you can achieve your desired reliability and you'll
probably find that a lot
of groundwork has already been laid that will facilitate your readable,
powerful
programming style.
Regards,
Andrew Bell
-----Original Message-----
From: MCENANEY WILLIAM J [SMTP:[EMAIL PROTECTED]]
Sent: Sunday, May 24, 1998 1:56 PM
To: [EMAIL PROTECTED]
Subject: Hey, could someone critique a li
Hi Friends,
I'm back. What's that I hear, a groan? Grin. Since "nice" is
a vague word,
I don't know what is nice about "!strcmp()." But if we're
talking about
readability and aesthetic appeal, I would love to change C.
Call me a nit-
picker. But if I wanted to find out whether two strings were
identical, I'd
want to use an equal sign in my "if" statement.
Say I need to keep using strcmp(). Then I might define
constants to stand
for values that strcmp() returns. I could write:
if (strcmp(s1, s2) == SAME)
puts ("They're the same.");
else
puts ("They differ.");
I'm no expert in C, but I'm a perfectionist about readability.
Though my
idea me not please an expert C programmer, it tells my readers
what I mean.
What do you think?
Best wishes,
Bill