TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Andrew Clarke
from: Frank Adam
date: 1996-05-02 19:14:24
subject: Filename Expansion

G'Day Andrew,
 
-=> Quoting Andrew Clarke to Frank Adam <=-
 
 > Oh, yes i could have: if(!strcmp("bla","bla")) dothat();
 > Do we like that ? ;)

 AC> I'm not sure I fully understand what you're getting at there Frank. 
 AC> Few (if  any?) standard C library functions return 1 for success and 
 AC> 0 for failure.  That's just the way it is.
That's exactly what i'm getting at, i see no reason why it had to be that
way, but i'd love to know any of those reasons if one exists. 

 AC> I'm not sure how a function returning 0 on success can't be 
 AC> tested in a boolean expression though.
 AC> #include 
 AC> int myFunc(void)
 AC> {
 AC> return 0;
 AC> }
 AC> int main(void)
 AC> {
 AC> if (myFunc() == 0) 

Wouldn't the above be nicer if it could be: if(myFunc() == TRUE) ?
Or simply: if(myFunc()) 
            else if(!myFunc())    

That's the whole argument, why can it be like that in some functions, 
and not in others, especially ones which only return two possible values ?
..And the answer is "That's just the way it is" ;-)             
                     
  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™.