Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!decwrl!sgi!key!perry From: perry@key.COM (Perry The Cynic) Newsgroups: comp.sys.mac.programmer Subject: LSC 3 bug with hex constant handling? Summary: "0x1" is different from "1"? Keywords: Lightspeed C Message-ID: <861@key.COM> Date: 11 Jun 89 23:09:57 GMT Reply-To: perry@arkon.key.COM (Perry The Cynic) Organization: Key Computer Laboratories, Fremont Lines: 20 Consider the following code fragment for Lightspeed (aka THINK) C 3.0.2: long a, b; a = b & ~1; This clears the least significant bit of b. It works just fine. However, if I replace the "1" with its hex equivalent, i.e. a = b & ~0x1; then the resulting code uses the constant 0x0000FFFE (rather than 0xFFFFFFFE) as operand to the "&" operator, resulting in less than satisfactory results. Question: is this a bug, or am I overlooking something? I think that the decimal and hex forms of a constant are semantically equivalent. (Also, which one is the bug? :-) BTW, using "0x1L" works, as does (of course) "1L". Thanks -- perry -- ------------------------------------------------------------------------ Perry The Cynic (Peter Kiehtreiber) perry@arkon.key.com ** What good signature isn't taken yet? ** ...!pacbell!key!perry