Re: I need help please!
- From: Nick Keighley <nick_keighley_nospam@xxxxxxxxxxx>
- Date: Mon, 10 Mar 2008 04:55:58 -0700 (PDT)
On 9 Mar, 17:49, "Bill Reid" <hormelf...@xxxxxxxxxxxxxxxx> wrote:
santosh <santosh....@xxxxxxxxx> wrote in message
news:fr042e$ee5$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bill Reid wrote:
santosh <santosh....@xxxxxxxxx> wrote in message
news:fqusqh$o1$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
A library routine must try to deal sensibly with all reasonable
possibilities. CTRL-D is often used to signal end of input, or as a
wish to exit from the program. That is another option that you should
try to present, wherever it makes sense: allowing a user to exit the
application without having to kill it with CTRL-C or 'kill'.
Well, my "user" is me, and me alone, [ ... ]
not once you've posted it and described it as a general purpose
library.
(though I have to confess I rarely check for errors from fgets())
Yes, but the point it you posted it for public consumption, so it is
only fair of you to point out places in your code where you invoke
behaviour not guaranteed by the Standard.
And I just plain disagree with your notion of "fair".
why? Is your first language not english. In uk-english "only fair"
is an idiom for "reasonable"
For that matter,
I just plain disagree with the silly notion presented quite often here
about the ostensible charter of the group, that it must slavishly only
and anal-retentively discuss "standard" C, and then only a down-rev
standard, not the latest one!
it is perhaps taken a bit far sometimes. But on the other hand
why use non-portable constructs when portable ones are available?
I suspect you don't know which are which.
There I said it, and not for the first time, and I have VERY good
(and "fair", and PRACTICAL) reasons for saying it. If you disagree,
well, it's your prerogative to be wrong...occasionally, it even happens
to me!
but you seem incapable of stating your good, fair and practical
reasons.
Note ALL UPPER CASE and lots of !! don't substitute for reasoned
arguement
In the instant case, I noted generally that a lot of stuff in the code
was "non-portable", and as a PRACTICAL matter I don't think it is
"fair" to waste people's time requiring them to document every single
unseen macro definition, compiler extension, etc., because it's
not just MY time you're wasting, you're also wasting the valuable
learning time of all those "newbies" you're so worried about.
In the "real world", any non-trivial quality C code is ALWAYS
"non-portable" because at the least it relies heavily on non-"standard"
libraries, INCLUDING in many cases "portability" libraries that
deal with platform dependencies, or in the case of code that is
intended to be used on a single platform, correctly and PRACTICALLY
uses specific platform system calls and "extensions".
It's never too early for the "newbies" to learn that valuable lesson
CORRECTLY,
but you aren't teaching the lesson, you're encouraging him to
ignore it!
and the technically inaccurate and misleading
personal attacks that the trolls who infest this group post whenever
the topic of C programming is actually attempted to be discussed
IS NOT AT ALL HELPFUL in clarifying the true nature of the topic.
as I've said many times, and
I know exactly how and when to exit the application (as a matter of
fact, generally you are offered the option to "abort" in all menus,
which is usually a RETURN default that bumps you back to a previous
level menu, so press RETURN about three or four times tops and you're
done)...
Fine, but I couldn't know this could I? Your posted code did not show
this option.
You also didn't know what "DEF_YES", "DEF_NO", "YES", "NO",
etc., etc., etc., meant either. There's all kinds of stuff you "don't
know", but as a PRACTICAL matter why should I have to document
every single aspect of my applications, libraries, etc., just to share
some simple code that speeds development time, reduces redundant
coding, and prevents program crashes due to the typical "fat-finger"
user error for ME (which is exactly ALL I claimed for it, not that it met
with some abusive troll's fantasy requirements for "correct" coding)?
have you ever been to a code review?
so MY library deals with all MY reasonable possibilities, so
it's "golden" by your "standard"...
In short, the routine works for ME...for others, a few tweaks may be
in order...
Exactly. And once such tweak the hapless newbie might have to do is to
comment out your fflush(stdin) line. But since you don't mention it's
non-portability in the code, the newbie is likely to waste his time and
shed a few hairs trying to figure out why the code doesn't work like
it's author said it should.
Once again, there was NO misreprentation on my part as to the
"portability" of the code. And the sooner the "newbie" learns that
valuabe lesson, the quicker they won't be a "newbie" any more.
but he *won't* learn it from your code because you don't document the
unportable bits!
The problem here is that most of the regulars have NEVER learned
that lesson,
what lesson?
so they are technically and intellecually unable to "help"
ANYBODY, and they further compound it by lashing out with abusive
personal attacks based on technical and statistical inaccuracies
that just make it even more confusing than it already is...and
THAT'S not "fair"...
boo hoo. Gently encouraging people to write more portable code is a
good thing. Some code has to work on more than one platform and
last more than a week. Presumably you've never seen code
break over endianess or alignment when it was ported.
It is good programming practice to write portable code when you can.
And to confine the non-portable code to limited well documented
modules.
Using fflush(stdin) is just plain dumb.
--
Nick Keighley
.
- References:
- I need help please!
- From: Jim
- Re: I need help please!
- From: Bill Reid
- Re: I need help please!
- From: Richard Heathfield
- Re: I need help please!
- From: Bill Reid
- Re: I need help please!
- From: santosh
- Re: I need help please!
- From: Bill Reid
- Re: I need help please!
- From: santosh
- Re: I need help please!
- From: Bill Reid
- Re: I need help please!
- From: santosh
- Re: I need help please!
- From: Bill Reid
- I need help please!
- Prev by Date: Re: Implicit int (was: rand and srand)
- Next by Date: Re: Backtick, at-sign, dollar-sign: legal in source?
- Previous by thread: Re: I need help please!
- Next by thread: Re: I need help please!
- Index(es):
Relevant Pages
|