Re: eof/file-size consistency semantics

Ian E. Stockdale (ies@nas.nasa.gov)
Mon, 21 Apr 1997 16:09:56 -0700 (PDT)

Ian Stockdale wrote:
>> Definitions:
>> -----------------------------------------------------------------
>> The {\it size} of an \MPI/ file is measured in bytes from the
>> beginning of the file. A newly created file has a size of zero
>> bytes. Using the size as a displacement gives the position of
>> the byte immediately following the last byte in the file. This
>> location is the {\it end of file}.

John May asked:
> This works only with the default view, right?

Since the displacement is an absolute byte position, this is
independent of view. (This could also be phrased in terms of the
default view, but I preferred to minimize the dependencies in the
definition.)

Ian Stockdale wrote:
>> In MPI_Seek:
>> Modify to obtain:
>> \const{MPI\_SEEK\_END}:
>> the pointer is set to the end of file plus \mpiarg{offset}

John May asked:
>Assuming that the size is independent of the view, what happens
>if EOF falls on a hole?

I believe that the file would look like:
( '-' = hole, 'd' = data, 'E' = EOF, x = file pointer )

dddddddd--------E-----
x

if offset is positive and

dddddddd--------E
x

if offset is negative.

-Ian

-- 
Ian E. Stockdale	MRJ Technology Solutions, NASA Ames Research Center
ies@nas.nasa.gov	(415) 604-4628