Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!bbn.com!mesard From: mesard@bbn.com (Wayne Mesard) Newsgroups: comp.sys.mac.programmer Subject: Re: ?Bug? in LsC Preprocessor. Summary: No bug. Keywords: LsC, C, Preprocessor Message-ID: <37855@bbn.COM> Date: 28 Mar 89 15:38:14 GMT References: <11796@umn-cs.CS.UMN.EDU> Sender: news@bbn.COM Reply-To: mesard@BBN.COM (Wayne Mesard) Distribution: usa Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 34 In article <11796@umn-cs.CS.UMN.EDU> goers@umn-cs.cs.umn.edu (Kenny Goers) writes: >Ho Netland, > >I'm having a problem with a macro in LsC. The following macro is preprocessed >"correctly" with the Sun and Sequent C preprocessors but in LsC I get >just a syntax error. > >#define check_size(name) \ > if (e_/**/name >= l_/**/name) { \ > register nsize = l_/**/name-s_/**/name+400; \ > name/**/buf = (char *) realloc(name/**/buf, nsize); \ > e_/**/name = name/**/buf + (e_/**/name-s_/**/name) + 1; \ > l_/**/name = name/**/buf + nsize - 5; \ > s_/**/name = name/**/buf + 1; \ > } > As dozens of others have, no doubt, said by now, using "/**/" to concatenate to macro arguments is an artifact of BSD's pcc. To the best of my knowledge it was never intended, and has certainly never been portable! The good news is that the ever-emergent ANSI standard does provide a portable way of doing this (although it's nearly as ugly): the double pound sign. E.g.: #define CONCAT(A,B) A##B This will work in LSC. -- unsigned *Wayne_Mesard(); "Newborns are slimy! I like nice clean MESARD@BBN.COM babies in front-packs." BBN, Cambridge, MA -DB.