[Coco] help with C problem

Gene Heskett gene.heskett at verizon.net
Mon Jan 2 11:13:20 EST 2006


On Monday 02 January 2006 06:54, Bob Devries wrote:
>To all you C gurus: I have a problem with compiling the following
> code:
>
>char *
>strhcpy(s1, s2)
>char *s1;
>char *s2;
>{
>         while ((int)*s2 < 128) { /* line 8*/

Have you tried 127?  I'd suspect the infamous sex is messing with you.
Actually, I think I'd also use <= to get the 127th character. Starting 
with a zero, that would then be 128 chars moved.

>               *s1++ = *s2++;
>               }
>         *s1++ = *s2++ & 0x7F;
>         *s1 = '\0';
>         return (s1);
>}
>
>The compiler always gives a warning  in line 8:  [Warning] comparison
> is always true due to limited range of data type
>
>Can someone PLEASE tell me what I'm doing wrong?
>Yes, you're right, I'm trying to write a PC version of the OS9
> library function strhcpy().
>
>--
>Regards, Bob Devries, Dalby, Queensland, Australia
>
>Isaiah 50:4 The sovereign Lord has given me
>the capacity to be his spokesman,
>so that I know how to help the weary.
>
>website: http://www.home.gil.com.au/~bdevasl
>my blog: http://bdevries.invigorated.org/

-- 
Cheers, Gene
People having trouble with vz bouncing email to me should add the word
'online' between the 'verizon', and the dot which bypasses vz's
stupid bounce rules.  I do use spamassassin too. :-)
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2005 by Maurice Eugene Heskett, all rights reserved.



More information about the Coco mailing list