[comp.lang.c] "proper" output from cpp?

pbiron@weber.ucsd.edu (Paul Biron) (09/17/90)

Hi,

Can someone tell me whether this is "proper" output from cpp:

	% cat << EOF | /lib/cpp
	#define ABC abc
	#define XYZ xyz
	ABC.XYZ
	EOF

	# 1 ""


	abc .xyz


Note the extra space AFTER abc and before the '.'

This is the output from cpp on the NeXT (v1.0a) [which is
based on some version of gcc].

The output on every other machine I can get my hands on (which
include an HP 9000/800 series running HP-UX 7.0, a Sun Sparc running
SunOS 4.0 and some kind of VAX running 4.3 BSD) is:

	% cat << EOF | /lib/cpp
	#define ABC abc
	#define XYZ xyz
	ABC.XYZ
	EOF

	# 1 ""


	abc.xyz

Is there actually a "proper" output for this kind of use of
cpp?

Thanx,

Paul Biron      pbiron@ucsd.edu        (619) 534-5758
Central University Library, Mail Code C-075-R
Social Sciences DataBase Project
University of California, San Diego, La Jolla, Ca. 92093

pbiron@weber.ucsd.edu (Paul Biron) (09/17/90)

In article <2936@network.ucsd.edu> pbiron@weber.ucsd.edu (Paul Biron) writes:
>Can someone tell me whether this is "proper" output from cpp:
>
>	% cat << EOF | /lib/cpp
>	#define ABC abc
>	#define XYZ xyz
>	ABC.XYZ
>	EOF
>
>	# 1 ""
>
>
>	abc .xyz
>
>Note the extra space AFTER abc and before the '.'

I have been informed that the ANSI standard specifies that a space
SHOULD be placed around macro expansions.  And since gcc (and
cc on the NeXT) are ANSI compliant that this is "proper" output.
I also tried this using the -Aa ANSI switch in cc for HP-UX 7.0
and it inserts the space as well.  The other systems I mentioned
in my original posting (SunOS 4.0 and 4.3 BSD on a Vax were NOT
ANSI compliant); and hence my confusion.

Thanx,

Paul Biron      pbiron@ucsd.edu        (619) 534-5758
Central University Library, Mail Code C-075-R
Social Sciences DataBase Project
University of California, San Diego, La Jolla, Ca. 92093