ISSUE 446

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 446
Category errata
Synopsis 17.2.4 gives incorrect modes for reading
State open
Class errata-discuss
Arrival-DateAug 25 2003
Originator sharp@cadence.com
Release 2001b: 17.2.4
Environment
Description
Section 17.2.4 says that you can only read from files
opened in r or r+ mode. Assuming that the modes are
supposed to match C fopen modes, you should also be
able to read from files opened in w+ and a+ modes.
Being able to both read and write is what the update
modes are all about. If you can't read in w+ and a+
modes, then they are no different from w and a modes.
Fix

Audit-Trail

From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: sharp@cadence.com
Cc: etf-bugs@boyd.com
Subject: Re: errata/446: 17.2.4 gives incorrect modes for reading
Date: Tue, 26 Aug 2003 12:30:28 +0300

> Section 17.2.4 says that you can only read from files
> opened in r or r+ mode. Assuming that the modes are
> supposed to match C fopen modes, you should also be
> able to read from files opened in w+ and a+ modes.
> Being able to both read and write is what the update
> modes are all about. If you can't read in w+ and a+
> modes, then they are no different from w and a modes.

You seem to be correct.

The C standard also says things like,

"When a file is opened with update mode (+ as the second or third character in
the
above list of mode argument values), both input and output may be performed on
the
associated stream. However, output shall not be directly followed by input
without an
intervening call to the fflush function or to a file positioning function
(fseek,
fsetpos, or rewind), and input shall not be directly followed by output without
an
intervening call to a file positioning function, unless the input operation
encounters endof-
file. Opening (or creating) a text file with update mode may instead open (or
create) a
binary stream in some implementations."

If the intention is for the I/O routines to match the C standard,
then the LRM needs to either reference the C standard or repeat
much of the information contained in the C standard.

Shalom

Unformatted



Hosted by Boyd Technology