Re: <ctype.h> toLower()
From: Gene Wirchenko (gwirchenkoEXCEPT_at_CAPITALSwencomine.com)
Date: 12/05/03
- Next message: Greg Comeau: "Re: Hashmaps"
- Previous message: B. v Ingen Schenau: "Re: writing to a string"
- In reply to: Richard Heathfield: "Re: <ctype.h> toLower()"
- Next in thread: Greg Comeau: "Re: <ctype.h> toLower()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 05 Dec 2003 17:07:10 GMT
On Fri, 5 Dec 2003 07:17:10 +0000 (UTC), Richard Heathfield
<dontmail@address.co.uk.invalid> wrote:
>Jumbo wrote:
>
><snip>
>
>> I used to adopt this where I would return 0 for error and 1 for success.
>> Do you think is considered generally acceptable amongst programmers?
>
>If used consistently, it's fine.
>
>> I think I changed becasuse main returns 0 or something and I started
>> using -1 for errors but I don't really have a strategy any more.
>
>My approach is based on the fact that programmers typically don't care *how*
>something worked as long as it worked, but they often care very much how it
>*didn't* work. Therefore, we only need a single code for success, but it
>can be very useful to have more than one code for failure. Therefore, I use
>the convention that 0 means success, and *anything else* means that
>something, somewhere, went wrong. The precise meaning of the returned code
>will obviously depend on circumstances.
I often want more than one success code, say an unqualified
success and one that warns. For example, it might be correct that a
file not exist, but it might be worth warning about without aborting
the processing.
>I wrote an error message generation facility which allows you to manage this
>process quite effectively. Here's an example. First, we write a text file
>to define our error messages:
I try to arrange my error messages in increasing severity or in
the order that the conditions are checked for.
[snip]
>The utility, naturally, is written in 100% ISO C. I developed it on Linux,
>but I am 100% confident that it will work on any conforming hosted
>implementation. All you have to do is grab the source (which is on my Web
>site) and compile it for your platform. This portability lark is rather
>handy, isn't it?
You are preaching a bit, but that is OK<s>. Not everyone is in
the choir.
Sincerely,
Gene Wirchenko
- Next message: Greg Comeau: "Re: Hashmaps"
- Previous message: B. v Ingen Schenau: "Re: writing to a string"
- In reply to: Richard Heathfield: "Re: <ctype.h> toLower()"
- Next in thread: Greg Comeau: "Re: <ctype.h> toLower()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]