[comp.lang.c++] Making AT&T C++ for Sun 34

seindal@diku.dk (Rene' Seindal) (05/20/88)

In article <1231@ektools.UUCP> ken@ektools.UUCP (Kenneth J. Lester) writes:
>This probably has been discussed before, but could someone tell 
>me how to make AT&T C++ version 1.2.1 for the Sun 3 family of
>computers (O/S 3.x).  It makes just fine, but when executed
>via CC, cfront runs and never returns.  I've run the bsd.fix
>script, and have tried compiling it with compilers gcc, and Sun 
>cc compilers from Sun O/S 3.2 and 3.5.

>I know I'm doing something wrong but I followed the same make
>procedure on a Vax running Ultrix 2.2 and it works just fine.
>(Note Ultrix 2.2 is a BSD derivative).

You are not really doing anything wrong.  It is actually an error in
stdio.h.  The beginning og the definition of _iobuf in my stdio.h look
like this:

# ifndef FILE
extern	struct	_iobuf {
#if vax || u3b || u3b2 || u3b5 || mc68k || sparc || mc68020 || mc68010
	int	_cnt;
	char	*_ptr;
#else
	char 	*_ptr;
	int 	_cnt;
#endif

You are missing the test for "sparc" and "mc680[12]0" in your file, so the
two fields was interchanged, when you compiled cfront.

It annoys me a bit that the test is on the cpu type, instead of on the
operating system.  I would like the test to say

#if BSD || SunOS || ...

instead, since this is more an OS dependency than a hardware
dependency.  Unfortunately, none of the C compilers I have seen will
make any defines like this. (why not??)

Rene' Seindal, DIKU, U. of Copenhagen, Denmark. (seindal@diku.dk)

chris@mimsy.UUCP (Chris Torek) (05/24/88)

In article <3824@diku.dk> seindal@diku.dk (Rene' Seindal) writes:
>...  It is actually an error in [the C++] stdio.h.  The beginning of
>the definition of _iobuf in my stdio.h look like this:

>#if vax || u3b || u3b2 || u3b5 || mc68k || sparc || mc68020 || mc68010
>	int	_cnt;
>	char	*_ptr;
>#else
>	char 	*_ptr;
>	int 	_cnt;
>#endif

>It annoys me a bit that the test is on the cpu type ....

The real problem is that C++ has a separate <stdio.h>.  This is (or
should be) entirely unnecessary, but to get rid of it may require some
co-operation from your vendor:

% cat -n /usr/include/stdio.h | sed -e '77,81p;131,135p;d'
    77	#if defined(__STDC__) || defined(c_plusplus)
    78	
    79	/* these are sorted to match /usr/lib/lint/llib-lc */
    80	extern int fclose(FILE *stream);
    81	extern FILE *fdopen(int fd, const char *type);
   131	
   132	#else /* __STDC__ || c_plusplus */
   133	
   134	int	fclose();
   135	FILE	*fdopen();
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris