Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c Subject: Re: Questions about C on a Prime (primix) Message-ID: <325@hadron.UUCP> Date: Sat, 22-Mar-86 04:23:20 EST Article-I.D.: hadron.325 Posted: Sat Mar 22 04:23:20 1986 Date-Received: Tue, 25-Mar-86 03:24:11 EST References: <988@plus5.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 33 Keywords: Primix, C, char, NUL Summary: Use NUL or whatever. Don't assume: it makes ... In article <988@plus5.UUCP> hokey@plus5.UUCP (Hokey) writes: >I was told that their C port keeps the 8th bit *on* for all ascii characters. >This seems kind of strange. Near as I can tell, this means the following >code fragment won't work: > strcpy(dst, src) > char *dst; > char *src; { > while(*dst++ = *src++) ; > return;} I've never really liked this kind of code: it always seemed to me to be assuming something that, someday, on some weird machine, would fail. Surprise! My rule is to always use an explicit reference to a defined constant: while ((*dst+= = *src++) != NUL); This way, if my character set changes, I worry about this less. By the way, will your P**** machine take a constant like #define NUL '\0' and turn it into an eighth-high character? By the way, your indentation above seems to me a tad peculiar. char *strcpy(dst, src) char *dst; register char *src; { register char *d = dst; while ((*d++ = *src++) != NUL); return(dst); } -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}