Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.sources.bugs Subject: Re: sc 6.1 - Allow ANSI pre-processor and read-only strings Message-ID: <816@twwells.uucp> Date: 4 Apr 89 01:23:53 GMT References: <137@titania.warwick.ac.uk> <16445@yoyodyne.mips.COM> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 33 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <16445@yoyodyne.mips.COM> koblas@mips.COM (David Koblas) writes: : In article <137@titania.warwick.ac.uk> cudcv@warwick.ac.uk (Rob McMahon) writes: : > : >! #define ctl(x) ('x'&037) : > : >--- 65,71 ---- : > : >! #define ctl(x) ((x)&037) : > : : Instead of doing this change there is a much simpler solution, which : of course allows you to not make such a huge change to existing code. : : #ifdef __STDC___ : # define ctl(x) (#x[0]&037) : #else : # define ctl(x) ('x'&037) : #endif What makes you think that it is only ANSI that doesn't allow the 'x' to be expanded? Well, here's some news: there are comparatively few compilers that will expand the 'x'. Most don't. ANSI is merely formalizing this situation. Also, I wouldn't use your suggestion for ANSI: unless you have a smart compiler writer, that is likely to generate allocated memory for the string even though the string is never used. --- Bill { uunet | novavax } !twwells!bill (BTW, I'm may be looking for a new job sometime in the next few months. If you know of a good one where I can be based in South Florida do send me e-mail.)