TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Peter Collis
date: 1996-05-06 10:56:24
subject: Filename Expansion

While listening to Frank Adam Pete heard:Filename Expansion

G'day Frank

 > After all if an operation was successful, in boolean terms it
 > would be TRUE, so functions returning 1 on success and 0 on
 > failure would make more sense.

 AC> You're saying a value of 1 be the only representation of True?
 AC> Why?

 FA> No , i was saying that in a boolean test True = 1 and False = 0,
 FA> so the functions returning a 0 on success seem out of sorts, not
 FA> to mention it  limiting my ability or desire to test the return
 FA> value as a bool True.

 FA> Oh, yes i could have: if(!strcmp("bla","bla")) dothat();
 FA> Do we like that ? ;)

Whats wrong with if(strcmp("bla","bla") == 0) dothat();
in both cases you will more than likely end up with the code

    CALL  strcmp
    CMP   AX, 0
    JNZ   {at}F
    CALL  dothat
 {at}{at}:

None of these functions return boolean values so can't be expected to
return either 'True' or 'False', they just return a flag value that
can be acted apon. In the case of strcmp() with just one call to the
string compare function you can act on 3 conditions without making
multiple calls so you end up with faster smaller code, Consider the
following, you have to compare two string and act on them being equal,
greater and less than each other.

in C you would

    switch(strcmp("bla","bla")) {
    case -1:
     /* less than code here */
    case  0:
     /* equal code here */
    case  1:
     /* greater than code here */
    }

the only way to achieve this with say basic which uses boolean
return values for string calls would be with multiple calls.

    if "bla" = "bla" then
     ' equal code here
    elseif "bla" < "bla" then
     ' less than code here
    else
     ' third call for less then not needed as only condition not
     ' tested for must now be true as others were false
    end if



   -=Pete=-


--- OMX/Blue Wave v2.12
* Origin: Gates of Hell (3:713/914.16)
SEEN-BY: 50/99 78/0 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 914 714/906
SEEN-BY: 800/1 7877/2809
@PATH: 713/914 615 888 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™.