Re: FREAD fails on files >4GB



On 30 Jul 2008 at 23:44, vippstar@xxxxxxxxx wrote:
On Jul 31, 1:30 am, Richie Kernagan <ho...@xxxxxxxxxx> wrote:
The parameters to fread size and count are both size_t ie 64 bits. Even
so the call fails when the size arg is greater than 4GB (ie exceeds 32
bit unsigned value).

So what? fread can succeed or fail.

Great. Just great.

When an implementation deviates by a tiny fraction from the golden
tablets of The Standard, the people here come down on it like a ton of
bricks. But as long as it obeys the letter of the law, noone minds how
poor the quality of implementation might be.

Do malloc() and fopen() always return NULL? No problem! That's OK
according to The Standard. Of course it makes no difference to "vip
star" and his friends, as it's clear they never actually program C in
the real world, so a program in the abstract machine that always
terminates gracefully with an informative error message like
"Program failed at line 1 - this implementation always returns NULL to
malloc()"
is just fine for them...just as long as the return type of main() is
right.

.



Relevant Pages

  • build world build kernel correct order?
    ... i've been having nightmares building my kernel and world on a clean system: ... P4 celeron 128M freebsd5.1 standard no fluff integrated motherboard. ... buildkernel fails in either mode at the same point in the build. ... rerunning cvsup changes the spot that the build fails in. ...
    (freebsd-current)
  • Re: Malloc
    ... standard *could* have provided a method for getting a list of files ... is specific to Unix even though they are provided with Unix type ... I know of systems where opening a binary file in text mode fails. ...
    (comp.lang.c)
  • Re: Malloc
    ... The> standard *could* have provided a method for getting a list of files> where the "file list open" function took a name that the implementation> treated as it wished with no guarantee that the "file list open"> function would succeed and no guarantee that> you can open the files that are listed. ... > There are a number of "unix utilities" that do not rely on anything that> is specific to Unix even though they are provided with Unix type ... I know of systems where opening a binary file in text mode fails. ... So unless you are saying you cannot open *any* file without using some non-standard method to specify which fork the program would still work, ...
    (comp.lang.c)
  • Re: free() unreliable?
    ... In comp.lang.c, nembo kid wrote: ... As far as the C standard goes, freewill free the pointed-to memory space, ... even standard libraries have flaws. ... So, yes, freesometimes fails. ...
    (comp.lang.c)
  • Re: malloc behavior on failure
    ... I know there are a couple of non standard c includes here and the POSIX ... //set subsequent timer intervals ... When the malloc fails the timer stops ... After some research it appears that when malloc ...
    (comp.lang.c)