[comp.lang.c] #include in Whitesmith

gwyn@brl-smoke.ARPA (Doug Gwyn ) (11/29/87)

In article <10568@brl-adm.ARPA> ADLER1%BRANDEIS.BITNET@WISCVM.WISC.EDU writes:
>Question: What is different about Whitesmith's C Compiler ...

It's probably more strict about checking for C usage violations.
I suspect that "types.h" is attempting to typedef some data types.
It is an error to typedef the same name more than once in the same scope.

> ...and what can my friend do about this ?

Either around the invocations of "types.h" or, better, inside "types.h"
around everything useful, use one-time flag brackets as in:
	#ifndef ALREADY_DEFINED	/* this name needs to be unique */
	#define	ALREADY_DEFINED
	/* typedefs etc. go here */
	#endif

ADLER1%BRANDEIS.BITNET@wiscvm.wisc.EDU (11/29/87)

A friend of mine has been porting a program to the IBM 370
where it is to be compiled using the Whitesmith C Compiler.
He writes:

>Al--
>   The compiler has no qualms about the absence of main() but screams bloody
>murder when both (or more) files compiled together use types.h or one uses
>style.h and the other uses vars.h, both of which use types.h. This thing is
>too complicated for beginners like us to keep track of all the entry points.

Question: What is different about Whitesmith's C Compiler and what can
          my friend do about this ?


ADLER1@BRANDEIS.BITNET

ftw@datacube.UUCP (11/30/87)

All of the Whitesmiths header files have cookies in them that will prevent
their inclusion more than once.  The cookies have predictable names, for
instance, at the top of types.h, you should see:

#ifndef __TYPES__
#define __TYPES__	1

<body of types.h>

#endif

Tell us more of what your friend means when he says "when I compile them
together".  Does he mean that he appends the files together before passing
them to the "cc" exec (doubtful), or does he mean that he passes the names
of both of the files to cc?



				Farrell T. Woods 

Datacube Inc. Systems / Software Group	4 Dearborn Rd. Peabody, Ma 01960
VOICE:	617-535-6644;	FAX: (617) 535-5643;  TWX: (710) 347-0125
INTERNET: ftw@datacube.COM
UUCP: {rutgers, ihnp4, mirror}!datacube!ftw