Geoff Clare wrote: > For fread(), the return type is size_t not ssize_t, so it doesn't > have quite the same problem. The question is what should happen if > the mathematical product of the size and nitems arguments is greater > than SIZE_MAX. POSIX defers to the C standard on this and there is no > reason for us to state anything specific about it. (The C standard > is silent on the matter, so the behaviour is implicitly undefined.)
The C standard is not silent on the matter -- it just does not treat it as a special case. The way fread() is specified does not depend on the total size of the array not exceeding SIZE_MAX bytes. ---------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.