🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Jonathan P. Leech Fri, 25 Apr 1986 04:56
System V preprocessor problem with <generic.h>
#169
Author: Jonathan P. Leech
Date: Fri, 25 Apr 1986 04:56
39 lines
1742 bytes
Expires:
Sender:
Followup-To:

Organization : California Institute of Technology
Keywords:

    The <generic.h> header file defines constructs of the form

	#define name2(a,b) a\
	b
	#define name3(a,b,c) a\
	b\
	c

    with the intent of producing

	name2(a,b) => ab    etc.

    unfortunately the  System  V  cpp  (at  least  the	HP  and  ELXSI
versions) instead produces

	name2(a,b) => a b

    this is a serious problem in  every  case  I  can  find  of  these
constructs  being  used  -  specifically  <vector.h>.  I  don't  think
there's any way to produce this behavior with the System V cpp.

    Combined with the problem of '//' comments	not  being  elided  by
cpp, I think C++ should come with its own  preprocessor  (or  have  it
integrated into cfront).

    Additional	amusement:  try  running  cpp  with  input  from  your
keyboard and #include <generic.h>. Note that it now takes > 1  EOF  to
get out of cpp!
-- 
    Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon)
    Caltech Computer Science Graphics Group
    __@/
Re: System V preprocessor problem with <generic.h>
#162
Author: guy
Date: Tue, 29 Apr 1986 02:11
22 lines
1311 bytes
> Try this fix for system V cpp:
> 
> 	#define name2(a,b)	a/**/b
> 	#define name3(a,b,c)	a/**/b/**/c
> 
> This works because the system V cpp strips the comments from the input.

So do earlier versions of Reiser's "cpp"; this is the "canonical" way of
concatenating two arguments to a macro, and is heavily used in 4BSD.  It
has, however, two problems:

	1) If you run your code through "lint", it won't work - "cpp"
	   is run by "lint" with the "-C" flag, which tells it not to
	   strip comments (for obvious reasons).

	2) It is not a guaranteed property of the C language, but a
	   quirk of the implementation, so it will not work in
	   general.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.arpa
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads