Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site rochester.UUCP Path: utzoo!linus!genrad!mit-eddi!mit-vax!eagle!harpo!seismo!rochester!bukys From: bukys@rochester.UUCP Newsgroups: net.lang.c Subject: Re: type casting problem Message-ID: <1923@rochester.UUCP> Date: Fri, 10-Jun-83 09:48:41 EDT Article-I.D.: rocheste.1923 Posted: Fri Jun 10 09:48:41 1983 Date-Received: Sat, 11-Jun-83 10:39:13 EDT References: <112@decvax.UUCP> Organization: University of Rochester Lines: 13 As Dennis Ritchie points out, if the goal is for the code to be portable to compilers which don't support unsigned chars, use a mask. If, on the other hand, you just want to write it right, try char *cp; ... checksum ^= *(unsigned char *)cp; which does the cast before it's too late (before the dereference). So, if the compiler supports unsigned characters, you're in. Liudvikas Bukys