Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick From: nick@cs.edinburgh.ac.uk (Nick Rothwell) Newsgroups: comp.sys.mac.programmer Subject: Re: THINKC 4.0.2 #define is short Keywords: #define preprocessor short int << Message-ID: <1892@skye.cs.ed.ac.uk> Date: 14 Nov 90 13:13:33 GMT References: <2374@moscom.UUCP> Sender: nnews@cs.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk Organization: Wavetables 'R' Us Lines: 25 In article <2374@moscom.UUCP>, tcm@moscom.UUCP (Tom Maszerowski) writes: > > Here's a gotcha in THINK C 4.0.2 that got me. It's probably in the > manual somewhere, but a cursory galnce didn't reveal it ( I couldn't > find any reference to #define or the preprocessor anywhere in the index). > Anyway, this is what happened: > > given: > > #define MaxAllocation (1<<16) > > sets MaxAllocation to 0. Er, no, the #define is just textual substitution. It doesn't know about ints, longs, or anything (perhaps besides comments and newlines and stuff for macro parameter substitution). I think "1<<16", in isolation, is meaningless in THINK C (well, it's 0). Try "1L << 16" or something. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcsun!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ "Now remember - and this is most important - you must think in Russian."