🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #396

Re: Small mistake in RENO code

#396
From: Chris Torek
Date: Mon, 24 Jun 1991 01:22
24 lines
1376 bytes
In article <1991Jun22.080642.27211@m.cs.uiuc.edu> march@cs.uiuc.edu
(Steve March) writes:
>In the file ..../sys/netinet/in.c, in the routine in_sockmaskof(), the
>variable mask is declared u_long (line 102) but is later assigned a
>negative value in line 115.  Doesn't look right to me.

The code in question is:

	register u_long mask;
	...
	mask = -1;

which is intended to set `mask' to all-ones.  Since all the machines on
which 4BSD runs are 2's complement, this is fine; it would, however, be
better in some sense to use

	mask = ~0UL;

so as to guarantee this result in all cases.  Unfortunately, `U'-suffixed
constants are not recognized by the 4.3-reno Vax and Tahoe C compilers.
Perhaps `mask = ~0L' would suffice. :-)
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
Technical Details
Message-ID: <14605@dog.ee.lbl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek
References: <1991Jun22.080642.27211@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek
From: torek@elf.ee.lbl.gov (Chris Torek)
Newsgroups: comp.bugs.4bsd
Subject: Re: Small mistake in RENO code
Keywords: Oops!
Message-ID: <14605@dog.ee.lbl.gov>
Date: 24 Jun 91 01:22:28 GMT
References: <1991Jun22.080642.27211@m.cs.uiuc.edu>
Reply-To: torek@elf.ee.lbl.gov (Chris Torek)
Organization: Lawrence Berkeley Laboratory, Berkeley
Lines: 24
X-Local-Date: Sun, 23 Jun 91 18:22:28 PDT