From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <91b5ebacd2423c345a89544c3d45ed34@plan9.bell-labs.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] Include guards and multiple includes Date: Mon, 23 Oct 2006 16:23:03 -0400 From: geoff@plan9.bell-labs.com In-Reply-To: <2ce618c636a8a74af13258cdeaa93de0@plan9.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: d3598e4c-ead1-11e9-9d60-3106f5b1d025 I'd think the set of cpp keywords needed would be: ifdef, ifndef, else, endif, define, undef, and include. `line' is typically generated by other preprocessors (e.g., yacc) not by people. `pragma' is compiler-dependent, and we have uses for it on Plan 9, but most uses are in system-supplied headers files, not ones you'd write; `#pragma incomplete' is an exception. The main use we advocated in the paper for conditional compilation was providing default values, thus: #ifndef COPYSIZE #define COPYSIZE 8192 #endif and Henry Spencer suggested that this idiom might have been profitably bundled up as `#override symbol value' (`#ifndefdef' in the paper). The paper dates from an era of considerable diversity among Unix systems and the beginnings of migration to ANSI/ISO C and POSIX, so it was a time of transition. These days I'm not using conditional compilation or even cpp much. Plan 9 has shown us better alternatives to conditional compilation, and looking at some of my recent code, I see that I #include headers and #define an occasional macro for some expression and not much else. enums have replaced #define for integer constants, and that was always my main use for #define.