home *** CD-ROM | disk | FTP | other *** search
- From: bill@twwells.com (T. William Wells)
-
- In article <498@longway.TIC.COM> uunet!stealth.acf.nyu.edu!brnstnd (Dan Bernstein) writes:
- : From: brnstnd@stealth.acf.nyu.edu
- :
- : The question is self-explanatory. This is a practical question as well
- : as a theoretical one: I'd like a solution that is both conformant and
- : portable in the real world. Does (int) (unsigned int) ch do the trick?
- : What about (int) (unsigned char)?
-
- Excuse, but this is purely a C question, so I've directed
- followups to comp.lang.c.
-
- [ I'm not sure I agree, but I don't see comp.std.unix people clamoring
- to answer this question, so let's send it to comp.lang.c to see if there
- is more interest there. -mod ]
-
- Anyway, I don't think that either is
- guaranteed. One that is, assuming that the character is not in a
- register, is: *(unsigned char *)&ch.
-
- (NB: a char might be converted to a number larger than 255 if
- characters are larger than eight bits.)
-
- ---
- Bill { uunet | novavax | ankh | sunvice } !twwells!bill
- bill@twwells.com
-
- Volume-Number: Volume 18, Number 15
-
-