Macro parameters getting substituted into strings

der Mouse mouse at mcgill-vision.UUCP
Tue Apr 12 18:27:49 AEST 1988


In article <3222 at haddock.ISC.COM>, karl at haddock.ISC.COM (Karl Heuer) writes:
> In article <8035 at elsie.UUCP> ado at elsie.UUCP (Arthur David Olson) writes:
>>	#define LETR_a	'a'	[ditto for all of 'a'..'z', 'A'..'Z']
>>	#define CTRL(c)	((LETR_ ## c) & 037)
> Since you have to edit the source file anyway, why don't you just do
> it right in the first place?
> 	1,$s/CTRL(\(.\))/CTRL('\1')/g
> 	/^#define CTRL/s/.*/#define CTRL(c) ((c) & 037)/

Because there is no "the" source file.  There may be many source files
involved.  Arthur's fix involves changing only the file in which CTRL
is defined; your fix invovles changing not only that file but also all
files which use it.  This may be impractical or even impossible.

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list