HP3000-L Archives

August 2002, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Dennis Handly <[log in to unmask]>
Reply To:
Dennis Handly <[log in to unmask]>
Date:
Thu, 22 Aug 2002 09:02:30 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (27 lines)
 F. Alfredo Rego ([log in to unmask]) wrote:
: Here is one function from that source file, for your edification:
: static int replace_page ...
:      { char buf[PAGE_SIZE] ;
:          if ( !(seek_ok = *((int*)buf) ...

This isn't valid because there is no guarantee that buf is int aligned.
Better to use int buf[PAGE_SIZE/sizeof(int)];
(And round up if you don't think PAGE_SIZE is a power of two. :-)

: I know that memory was
: a super-valuable resource in the old days of legacy systems.  Nowadays,
: saving a few words of memory AND paying for the "saving" by recycling
: the same variable for totally different purposes is not necessary.

Not true in all cases.  If you have threads, you don't want to blow the
trivially small thread stack of 64Kb on HP-UX if you have recursion.
(Currently the compiler flattens all of the locals.)
And having 1000 4 byte ints/pointers quickly grew when inlining was used.

: why not choose a neutral name that applies to ALL the file operations?

Yes.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2