lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 8 September 2011 11:39, liam mail <> wrote:
> I would disagree that it is a CRT bug.

Indeed not.

> fwrite which calls fputc is not required to set errno
> although POSIX says it does.

Indeed. Makes life easier when you're on POSIX.

> C99 fwrite states "If an error occurs, the
> resulting value of the file position indicator for the stream is
> indeterminate." (even though MS does not conform to C99).
> >From this I would draw the conclusion that the position indicator is
> an indeterminate state and therefore execution can not continue

Applying Microsoft's notion of execution being able to continue to the
C99 standard, which has no such notion, makes no sense. errno may be
set (hence POSIX can mandate that it does without contradicting the
C99 standard to which it defers), but the portable way to detect error
is to test ferror(), or the return value of fwrite.