[mod.std.c] mod.std.c Digest Volume 4 : Issue 13

osd7@homxa.UUCP (Orlando Sotomayor-Diaz) (03/12/85)

From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Mon, 11 Mar 85       Volume 4 : Issue  13 

Today's Topics:
           pre-processor, strings in macro bodies (2 msgs)
----------------------------------------------------------------------

Date: 11 Mar 85 17:22:20 CST (Mon)
From: ihnp4!cataly!arf (Alan Feuer)
Subject: pre-processor, strings in macro bodies
To: cataly!eagle!ihnp4!cbosgd!std-c

Judging from the discussion, the 1978 reference manual is ambiguous
as to whether strings in the body of a macro are scanned for formal
parameters.  The September 1980 reference manual (distributed within
Bell Labs and perhaps elsewhere) leaves no room for misinterpretation.
>From Section 12.1:

	... The number of formal and actual parameters must be
	the same.  Strings and character constants in the token-
	string are scanned for formal parameters, but strings
	and character constants in the rest of the program are
	not scanned for defined identifiers.


/alan feuer

------------------------------

Date: 9 Mar 85 02:17:37 CST (Sat)
From: utcs!mnetor!clewis (Chris Lewis)
Subject: pre-processor, strings in macro bodies
To: utcs!utzoo!ihnp4!cbosgd!std-c

I believe that rescanning of strings in macro bodies for formal parameters
WAS documented (in a relatively reasonable place).  The document
"Enhancements to C" (dated 1978 and included in several UNIX journals/
proceedings and in the Bell Labs distributions of C - eg. C/360) 
introduced this, plus enums and separate name spaces for structure fields.
Unfortunately, the sentence is relatively obscure in this area and requires
rather careful reading to find this out.

[ According to the article above by Feuer, the 1980 manual is clear
  in this area.  It probably was available outside Bell Labs. I
  requested from this author a quotation from the 1978 document, though.
  -- Mod -- ]

When this issue was first being 
discussed in the committee, I was working for IBM with our C standards
committee representative.  I believe that the committee either didn't 
have a copy of this document, or missed this "feature" in reading it.
Our representative mentioned something about it, and I was able to
find the document to find out exactly what it said.  He then was able
to show this documentation to the committee.  At this point, the committee
voted to leave it out mainly because it was "magic" and not in K&R.  
I objected strenuously to our rep., mainly with the argument that 
if the description was rephrased and put into the standard, then it 
wouldn't be "magic".  Unfortunately, our rep was one of the "let's make
it Pascal" group, with relatively little C or UNIX experience (that
was why I was hired!), and I was ignored.  (Our rep had the notion
that he was the departmental authority on everything (even with less than
6 months of real experience on C/UNIX), so, the (several) people with more
experience in C/UNIX/compilers/languages were ignored).
-----
Chris Lewis, Motorola New Enterprises
SNail: 560 Dennison, Unit 9, Markham, Ontario, Canada, L3R 2M8
UUCP: {allegra, linus, ihnp4}!utzoo!utcs!mnetor!clewis
BELL: (416)-475-1300 ext. 321

------------------------------

End of mod.std.c Digest - Mon, 11 Mar 85 21:19:03 EST
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.