[Coco] basename() source

Alex Evans alxevans at concentric.net
Sat Dec 31 15:40:07 EST 2005

On Dec 31, 2005, at 9:20 AM, Robert Gault wrote:

> After about 15 years of not using C and trying to relearn it in  
> about one week, I am remembering why I detest the language. :)
> Bob, your program works and seems simple but after digging into  
> this further I've come up with some interesting finds and thoughts.
> Clearly there is a problem with the Microware compiler but I have  
> found what triggers the lead mmnn,pcr syntax.
>  strrchr(file,"/" || "\\")
> gives the lead opcode but
>  strrchr(file,'/' || '\\')
> does not. Both of them give the ldd #1, which does not make any  
> sense but that's another story. The trigger was the double vs  
> single quote.

"/" || "\\" evaluates as as a logical or of two addresses neither of  
which will be zero.  This gives you a result of true (1)

'/' || '\\' evaluates as a logical or of 0x2F and 0x5C.  This also  
gives you a result of true (1)

It seems to me that the ldd #1 makes perfect sense.  That still  
leaves the mystery of the lead code.

More information about the Coco mailing list