🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #21679

unsigned vs. signed

#21679
From: Raymond Lau
Date: Mon, 16 Nov 1987 03:10
32 lines
2153 bytes
Recently I've upgraded my version of LightspeedC to 2.13.  By changing the
headers to the new ones that came with the upgrade, I had forgotten about
the many little changes I've put in.

I recompiled an application....and then ran it...wham, I am getting reports
of -36000k on my HD, etc.

The root of the problem was an obvious one.  Things were declared as signed.
What I don't understand is why some things which make totally no sense
whatsoever if their content is negative...are declared as signed.

In this particular case, why is the ioFrBlks (or whatever) of the volumeParam
field declared as a signed integer?  I cannot see how a volume can have a
negative number of free blocks.  Although it hasn't happened yet, bec. I
don't deal with drives of large allocation block sizes nor large files yet,
a similar problem can occur with the ioVAlBlkSiz field and the size fields
of the fileParam.  There are many other instances which can cause a similar
problem.

The only justification for this, which I think is silly, is that these fields
are declared as signed in Inside Mac.  I don't know why though...  but it's
silly for one to "correct" these declarations each time there is an update
out.  "So use your old headers!" - that's like saying...."So write your
own compiler!"...


-----------------------------------------------------------------------------
Raymond Lau                      {allegra,philabs,cmcl2}!phri\
Big Electric Cat Public Unix           {bellcore,cmcl2}!cucard!dasys1!raylau
New York, NY, USA                               {sun}!hoptoad/
GEnie:RayLau   Delphi:RaymondLau   CIS:76174,2617
"Take it and StuffIt."
Technical Details
Message-ID: <1986@dasys1.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!phri!dasys1!raylau

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!phri!dasys1!raylau
From: raylau@dasys1.UUCP (Raymond Lau)
Newsgroups: comp.sys.mac
Subject: unsigned vs. signed
Message-ID: <1986@dasys1.UUCP>
Date: Sun, 15-Nov-87 22:10:20 EST
Article-I.D.: dasys1.1986
Posted: Sun Nov 15 22:10:20 1987
Date-Received: Tue, 17-Nov-87 03:24:07 EST
Organization: The Big Electric Cat
Lines: 32
Keywords: Why use signed when it is meaningless?