Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site tyxpdp.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!wivax!cadmus!harvard!seismo!umcp-cs!tyxpdp!sam
From: sam@tyxpdp.UUCP
Newsgroups: net.unix-wizards,net.lang.c
Subject: LINT NOSTRICT MACRO
Message-ID: <117@tyxpdp.UUCP>
Date: Thu, 20-Sep-84 16:44:09 EDT
Article-I.D.: tyxpdp.117
Posted: Thu Sep 20 16:44:09 1984
Date-Received: Wed, 26-Sep-84 00:46:53 EDT
Organization: TYX CORP, RESTON VA.
Lines: 39


	A lint macro definition has proved to be useful at our shop.

	#ifdef lint
	#define NOSTRICT(type,exp)	((exp) ? type 0 : type 0)
	#else
	#define NOSTRICT(type,exp)	(type (exp))
	#endif

	With the NOSTRICT macro, lint complaints about casts of expressions
	are quieted for the desired expression, with full evaluation of
	any sub-expressions.

	The most useful place is with malloc(), which is typed char *,
	being cast to (struct type *).  Example:

	structpointer = NOSTRICT((struct type *),malloc(sizeof struct type));

	The macro utilizes a property of the conditional operator,
	where the type of the first expression does not affect the
	type of the result.

---
	Jeffrey Kegler @ tyxpdp
	TYX Corporation
	11250 Roger Bacon Drive Suite 16
	Reston Va 22090
	(703) 471-0233

	uucp - decvax!harpo!seismo!umcp-cs!tyxpdp!jeffrey
-- 
---
	Sam Chessman - sam@tyxpdp
	TYX Corporation
	11250 Roger Bacon Drive Suite 16
	Reston Va 22090
	(703) 471-0233

	uucp - decvax!harpo!seismo!umcp-cs!tyxpdp!sam