[net.bugs.4bsd] massive type confusion

geoff@utcs.UUCP (Geoff Collyer) (12/05/84)

Index:	/usr/include/sys/types.h 4.2BSD
Index:	/usr/include/sys/dir.h (aka /usr/include/dir.h) 4.2BSD
Index:	/usr/lib/lint/llib-lc 4.2BSD

Description:
	These files use int where long is correct and fail to use
	the types defined in <sys/types.h>.
Repeat-By:
	Lint a type-correct program that calls lseek, time and ctime
	and which passes lint on v7 (not 4.1BSD, not 2BSD).  Observe
	the utterly wrong and copious messages produced by lint.
Fix:
	Edit llib-lc to use off_t instead of long where appropriate
	(hint: ftell must be declared as returning long).
	Edit <sys/dir.h> to use ino_t (instead of unsigned long)
	and off_t where appropriate.  Edit <sys/types.h> to typedef
	off_t and time_t as long, *not int*.  Burn a new binary
	lint library for llib-lc.

	Use the types defined in <sys/types.h> in your programs!

	It is left as an exercise to the reader to make cc invoke
	lint before the C compiler and exit if lint complains.
Flame:
	int is not long on all machines.  I realise that the authors
	of 4.2BSD are too lazy to write type-correct code, but they
	could at least refrain from breaking existing, correct code
	such as <sys/types.h>.
	To paraphrase Dennis Ritchie, if you want BCPL, you know where
	to find it.  In the mean time, please start writing *C* programs,
	you know the ones, they have *type* declarations in them.

ted@usceast.UUCP (Ted Nolan) (12/08/84)

Along the same lines, the documentation for either getpid or kill(2) is
wrong.  It claims getpid returns a long, but the pid argument to kill
claims to be an int.

A quick look at the system code leads me to think that int is correct in both
cases.

			Ted Nolan	..usceast!ted
-- 
-------------------------------------------------------------------------------
Ted Nolan                               ...decvax!mcnc!ncsu!ncrcae!usceast!ted
6536 Brookside Circle                   ...akgua!usceast!ted
Columbia, SC 29206
      ("Deep space is my dwelling place, the stars my destination")
-------------------------------------------------------------------------------