TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1996-04-28 00:49:12
subject: Re: Filename Expansion

FA> Even though i do realize that these functions are not returning boolean 
FA> values, it baffles me that in a logical environment, i would have to use
FA> reverse logic to extract a boolean information from *anything*.
FA> Even the strcmp() is a good example to that :

FA> Q. is str1 the same as str2 ?

strcmp() is not a function that answers that question.  strcmp() is
a function which answers the question "which one of these strings
is 'alphabetically' bigger".

FA> Another one, for example you can't say: OK = rename(this,that); if(OK) bla;
FA> And in that one i'd rarely care about anything but a success.

Ok, this function returns 0 on success, non zero (not necessarily 1),
on failure.  Functions are often implemented like this so that if
nothing went wrong, you get a 0, but if something went wrong, you 
can have 27 million different return codes, all telling you what
went wrong.

FA> As a matter of fact a lot of string functions return values, which can be 
FA> used as booleans, strchr(), 

Actually that returns a pointer, which is a far cry from a boolean
value.

FA> strcpy() etc.. where FALSE would always mean

strcpy returns a pointer.

FA> a failure, (admittedly not much chance for a TRUE pointer :) ).

and strcpy never fails.  Not that your program can check for, anyway.

FA> Anyway, it's just trivial to me, and i'm not about to start either 
FA> re-writing the language, or produce code opposed to the standard, but
FA> i thought i'll have a little whinge. 
FA> It was still more interesting than the 'goto' thread in C_ECHO, and nobody
FA> flew off the handle here :-) 

No-one in here is ever on the handle in the first place.  We're all
ISO-C bigots.  Well we should be, anyway.  :-)  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.