🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Arthur David Olson Tue, 20 Sep 1988 19:42
Gnu C 1.28's assert.h and DPANS don't mix
#1719
Author: Arthur David Olson
Date: Tue, 20 Sep 1988 19:42
70 lines
2313 bytes
(We're running SunOS 4.0 on a Sun 3/110.)

Description:
	The "assert" macro defined in "assert.h" fails to evaluate to a
	void expression (see page 74 of the May, 1988 Rationale).

Repeat-By:
	Script started on Tue Sep 20 15:37:46 1988
	elsie$ cat try.c
	#include <stdio.h>
	#include <assert.h>

	int
	main()
	{
		assert(1), assert(1);
		return 0;
	}
	elsie$ gcc -v try.c
	gcc version 1.28
	 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dvax -Dunix try.c /tmp/cc019174.cpp
	GNU CPP version 1.28
	 /usr/local/lib/gcc-cc1 /tmp/cc019174.cpp -quiet -dumpbase try.c -version -o /tmp/cc019174.s
	GNU C version 1.28 (vax) compiled by GNU C version 1.28.

	try.c:7: parse error before `,'
	At top level:
	try.c:7: parse error before `}'
	elsie$ exit

	script done on Tue Sep 20 15:37:59 1988

Fix:
	*** 1.1/assert.h	Tue Sep 20 15:41:20 1988
	--- 1.2/assert.h	Tue Sep 20 15:41:22 1988
	***************
	*** 4,17 ****
	  #define assert(ignore)
	  #else
	  
	! #define assert(expression)  \
	!   do { if (!(expression)) __assert ((expression), __FILE__, __LINE__); } while (0)
	  
	  #define __assert(expression, file, line)  \
	!   { _eprintf ("Failed assertion " #expression		\
	! 	      " at line %d of `" file "'.\n", line);	\
	!     abort (); }
	  
	  void _eprintf ();		/* Defined in gnulib */
	  
	  #endif
	--- 4,18 ----
	  #define assert(ignore)
	  #else
	  
	! #define assert(expr)  \
	! 	( (expr)? (void)0 : __assert((expr), __FILE__, __LINE__) )
	  
	  #define __assert(expression, file, line)  \
	!   ( _eprintf ("Failed assertion " #expression		\
	! 	      " at line %d of `" file "'.\n", line),	\
	!     abort () )
	  
	  void _eprintf ();		/* Defined in gnulib */
	+ void abort ();
	  
	  #endif
-- 
	  The Canadian space program is into artificial catatonia.
	ado@ncifcrf.gov			ADO is a trademark of Ampex.
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