Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site mako.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!tektronix!orca!mako!jans From: jans@mako.UUCP (Jan Steinman) Newsgroups: net.lang.c Subject: Re: Hygiene of #define DIR "/usr/lib/news (CLEAN UP) Message-ID: <587@mako.UUCP> Date: Fri, 15-Feb-85 12:52:18 EST Article-I.D.: mako.587 Posted: Fri Feb 15 12:52:18 1985 Date-Received: Tue, 19-Feb-85 08:38:49 EST References: <5053@elsie.UUCP> Reply-To: jans@mako.UUCP (Jan Steinman) Organization: Tektronix, Wilsonville OR Lines: 26 In article <5053@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes: >... a thought-provoking way of doing string catenation... > > #define DIR "/usr/lib/news > >and used these defines in lines such as > > system(DIR/batch"); > Most pre-processors work with whitespace delimited tokens, so the above will not always work. However, tokens are not allowed to contain embedded comments, so this is a more portable way to do the trick: system(DIR/**//batch"); I use this technique regularly to produce unique labels for assembly macro expansion: #define MY_MACRO(garbage_in) \ .globl my_routine/**/garbage_in \ my_routine/**/garbage_in: \ ...(assembly code)... \ /* end define MY_MACRO */ -- :::::: Jan Steinman Box 1000, MS 61-161 (w)503/685-2843 :::::: :::::: tektronix!tekecs!jans Wilsonville, OR 97070 (h)503/657-7703 ::::::