TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Joshua Marshall
from: Frank Adam
date: 1996-04-27 02:15:04
subject: Re: Filename Expansion

G'Day Joshua,
 
-=> Quoting Joshua Marshall to Frank Adam <=-

 JM> strcmp does not return a boolean value.  It does not compare the
Yeah, i know that..and my hand is on the bible(well, the ISO draft) ;)

 JM> Since the function is not specified as returning a boolean 
 JM> value then you can't expect a boolean value out of it.  
 JM> What you want is:

 JM> int franks_strcmp(char *s1, char *s2)
 JM> {
 JM> int i;
It's not really, that i want it.. :-)

Maybe you've missed the start of the thread, i was referring to functions 
in general, (and strcmp() happened to pop in my mind) and mainly 
to the fact, that a lot of functions are designed to return values with 
meanings, opposite to what they would be if they were returning boolean.

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

Q. is str1 the same as str2 ?
A. 0 yes, -1 less,1 more.  
If i want to get that as boolean value for any reason, be it stupid or not,
the answer is if FALSE it is, if TRUE it's not.

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

Hope now you see what i meant...

As a matter of fact a lot of string functions return values, which can be 
used as booleans, strchr(), strcpy() etc.. where FALSE would always mean
a failure, (admittedly not much chance for a TRUE pointer :) ).

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

  L8r Frank (fadam{at}ozemail.com.au).
                                                    
___ Blue Wave/DOS v2.21
                                
                                

--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 78/0 620/243 623/630 632/349 635/503 544 727 711/401 409 410
SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 635/544 50/99 711/808 809 934

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™.