Newsgroups: comp.lang.pascal
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cunixf.cc.columbia.edu!cunixb.cc.columbia.edu!stone
From: stone@cunixb.cc.columbia.edu (Glenn Stone)
Subject: Variable sizes question
Message-ID: <1991May10.150700.524@cunixf.cc.columbia.edu>
Sender: usenet@cunixf.cc.columbia.edu (The Network News)
Nntp-Posting-Host: cunixb.cc.columbia.edu
Reply-To: stone@cunixb.cc.columbia.edu (Glenn Stone)
Organization: Columbia University
Date: Fri, 10 May 1991 15:07:00 GMT

Dear people who understand memory addressing better than I:

I must be making an obvious mistake but I can't figure out what it
is.  My data segment is too large and I want to list my global
variables by size to see what I should turn into pointers.  I
created a .MAP file, converted the hex addresses to decimal, read
it into a spreadsheet, and calculated variable sizes.  One variable
size makes no sense.  Here is the relevant part of the spreadsheet:


OFS:SEG(hex)  OFS(dec)  SEG(dec)  ADDRESS    SIZE   VARIABLE
------------------------------------------------------------
0D91:9656     3473      38486      94054        2   IOCODE
0D91:9658     3473      38488      94056        2   KBDCHAR
0D91:965A     3473      38490      94058    16642   PATH1
0D91:D75C     3473      55132     110700        2   DOSERROR
0D91:D75E     3473      55134     110702        1   CHECKBREA

The ADDRESS column is (OFS*16)+SEG.  The far left and far right
columns are from the .MAP file, I calculated the rest.

The problem is that PATH1, which is from a unit, is in fact a variable 
of type SEARCHTYPE, which is 130 bytes in size:

   SearchType = record
      FoundFile,
      FoundFirst : boolean;
      FileRec    : SearchRec;  { declared in DOS unit; 43 bytes }
      FileAttr,
      FilesFound : word;
      FileSpec   : str80;
      end;

This is verified by SIZEOF(path1).  Why does the .MAP file indicate
this variable is 16,642 bytes in size?  Or am I reading it wrong?

Also: is there an easier way to get a listing of variables by size?


-------------------------------------------------------------------------
  Glenn Stone                                      BITNET: stone@cunixc
  Columbia University            INTERNET: stone@cunixb.cc.columbia.edu
-------------------------------------------------------------------------
