The LRM does not address the semantics of $fread when the target array is a dynamic array. If we have: byte a[] = new[20]; and then do: count = $fread(a, fileh); should the size of the array be used to limit the read or should this be equivalent to an unbounded read and re-allocation of "a"? From 21.3.4.4 we have: If present, count shall be the maximum number of locations in mem that shall be loaded. If not supplied, the memory shall be filled with what data are available. and also: Consecutive words are loaded toward the highest address until either the memory is full or the data file is completely read. So what does "full" or "maximum number of locations" mean for a dynamic array? The question boils down to whether count = $fread(a, fileh); should be essentially count = $fread(a, fileh, 0, a.size()); or a = new[remaining_filesize(fileh)]; count = $fread(a, fileh, 0, remaining_filesize(fileh)); Since $fread is permitted to have explicit bounds, I'd be inclined to say that a read into a dynamic array reads the entire file unless an explicit bound is specified. Gord. -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Oct 15 08:31:04 2008
This archive was generated by hypermail 2.1.8 : Wed Oct 15 2008 - 08:32:22 PDT