comp.lang.ada
 help / color / mirror / Atom feed
From: karish@pangea.Stanford.EDU (Chuck Karish)
Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
Date: 1996/04/12
Date: 1996-04-12T00:00:00+00:00	[thread overview]
Message-ID: <4kk9e1$he1@nntp.Stanford.EDU> (raw)

Dave Emery roped me into this discussion, and now that I see how
nastily some people choose to express their frustration with a
ill-defined problem, I'm not sure whether to thank him.

Anyway, the problem as he posed it to me is whether code like

    /* sample 1 */
    char buf[100];
    ...
    i = read (fd, buf, 200);

is legal under the C and/or POSIX.1 standards.

My understanding is that it conforms to the C and the POSIX.1
standards but that it is not guaranteed to work.

Neither ISO/IEC 9945-1 (POSIX.1) nor ISO/IEC 9989 (Standard C)
specifies the details of storage in the calling environment.
This means that a conforming implementation could, but need not,
automatically adjust storage to allow 200 bytes of data to be
stored though only 100 bytes were allocated.

POSIX.1 specifically allows the implementation to report an error
for a condition that is not spelled out in the Standard:

     Implementations may support additional errors not included
     in this clause, may generate errors included in this clause
     under circumstances other than those described in this
     clause, or may contain extensions or limitations that
     prevent some errors from occurring.

My understanding is that this thread started around a discussion
of bounds checking under Linux that seems to go beyond the
requirements of POSIX.1.  According to the wording quoted
above, such extra stringency is allowed by POSIX.1.

There are a lot of things that are intentionally not spelled
out by standards.  Sometimes this is because the standard
writers want to limit the scope of the document to keep it
legible and usable, and sometimes it's because they don't want
to preclude implementors from offering usable products
based on current technology or from adding capabilities and
value to future products.

Anyone who craves a standard that describes every possible
aspect of system behavior with complete logical precision
is invited to study the later writings of Rene Descartes
and then get back to us.

--

    Chuck Karish          karish@mindcraft.com
    (415) 323-9000 x117   karish@pangea.stanford.edu




             reply	other threads:[~1996-04-12  0:00 UTC|newest]

Thread overview: 177+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-12  0:00 Chuck Karish [this message]
1996-04-11  0:00 ` ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada) Robert Dewar
1996-04-20  0:00   ` Bradd W. Szonye
1996-04-21  0:00     ` Danette & Murray Root
1996-04-23  0:00       ` Bradd W. Szonye
1996-04-21  0:00     ` Mike Rubenstein
1996-04-22  0:00       ` Tom Payne
1996-04-22  0:00         ` Peter Seebach
     [not found] <JSA.96Feb16135027@organon.com>
1996-03-26  0:00 ` C/C++ knocks the crap out of Ada Ed Falis
1996-03-28  0:00   ` Kevin Cline
1996-03-30  0:00     ` Jon S Anthony
1996-04-01  0:00       ` Kevin Cline
1996-04-02  0:00         ` Lawrence Kirby
1996-04-02  0:00           ` ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada) David Emery
1996-04-02  0:00             ` The Right Reverend Colin James III
1996-04-03  0:00               ` Bill Clinton
1996-04-03  0:00               ` David Emery
1996-04-03  0:00                 ` The Right Reverend Colin James III
1996-04-04  0:00                   ` Dan Pop
1996-04-04  0:00             ` Lawrence Kirby
1996-04-05  0:00               ` Robert Dewar
1996-04-05  0:00                 ` Lawrence Kirby
1996-04-05  0:00                   ` Robert Dewar
1996-04-06  0:00                     ` Peter Seebach
1996-04-06  0:00                       ` Robert Dewar
1996-04-16  0:00                       ` Philip Brashear
1996-04-16  0:00                         ` Robert Dewar
1996-04-19  0:00                           ` Chuck Karish
1996-04-05  0:00                 ` Peter Seebach
1996-04-05  0:00                   ` Robert Dewar
1996-04-06  0:00                     ` Lawrence Kirby
1996-04-06  0:00                       ` Robert Dewar
1996-04-07  0:00                         ` Lawrence Kirby
1996-04-10  0:00                           ` halvin
1996-04-10  0:00                             ` Peter Seebach
1996-04-11  0:00                             ` Dan Pop
1996-04-12  0:00                             ` Chuck Karish
1996-04-12  0:00                         ` Chuck Karish
1996-04-12  0:00                           ` Robert Dewar
1996-04-13  0:00                             ` Chuck Karish
1996-04-13  0:00                               ` Robert Dewar
1996-04-13  0:00                                 ` Peter Seebach
1996-04-13  0:00                                   ` Robert Dewar
1996-04-14  0:00                                     ` Lawrence Kirby
1996-04-15  0:00                                     ` Chuck Karish
1996-04-15  0:00                                 ` Chuck Karish
1996-04-16  0:00                                   ` Robert Dewar
1996-04-16  0:00                                     ` Chuck Karish
1996-04-16  0:00                                       ` Robert Dewar
1996-04-12  0:00                     ` Chuck Karish
1996-04-11  0:00                       ` Kazimir Kylheku
1996-04-12  0:00                         ` Tom Griest
1996-04-12  0:00                           ` Robert Dewar
1996-04-12  0:00                         ` Chuck Karish
1996-04-12  0:00                           ` Kazimir Kylheku
1996-04-12  0:00                       ` Robert Dewar
1996-04-13  0:00                         ` Chuck Karish
1996-04-13  0:00                           ` David Emery
1996-04-22  0:00                         ` Mike McCarty
1996-04-22  0:00                           ` David Emery
1996-04-05  0:00               ` David Emery
1996-04-06  0:00                 ` Lawrence Kirby
1996-04-06  0:00 ` Dan Pop
1996-04-07  0:00   ` Robert Dewar
1996-04-07  0:00     ` Peter Seebach
1996-04-08  0:00       ` Robert Dewar
1996-04-08  0:00         ` Lawrence Kirby
1996-04-08  0:00           ` Szu-Wen Huang
1996-04-08  0:00             ` James McIninch
1996-04-08  0:00               ` Szu-Wen Huang
1996-04-08  0:00                 ` Robert Dewar
1996-04-19  0:00                   ` Bradd W. Szonye
1996-04-08  0:00               ` Robert Dewar
1996-04-11  0:00                 ` Keith Thompson
1996-04-19  0:00                 ` Bradd W. Szonye
1996-04-08  0:00               ` Fergus Henderson
1996-04-08  0:00                 ` Robert Dewar
1996-04-19  0:00                 ` Bradd W. Szonye
1996-04-20  0:00                   ` Fergus Henderson
1996-04-20  0:00                     ` Bradd W. Szonye
1996-04-08  0:00           ` Robert Dewar
1996-04-08  0:00             ` Kazimir Kylheku
1996-04-09  0:00               ` Robert Dewar
1996-04-09  0:00                 ` Kazimir Kylheku
1996-04-09  0:00                   ` Robert Dewar
1996-04-09  0:00                     ` Kazimir Kylheku
1996-04-10  0:00                       ` Robert Dewar
1996-04-10  0:00                         ` Kazimir Kylheku
1996-04-10  0:00                           ` Robert A Duff
1996-04-19  0:00                           ` Bradd W. Szonye
1996-04-19  0:00                             ` Robert Dewar
1996-04-23  0:00                               ` Bradd W. Szonye
1996-04-10  0:00                 ` Mike Shannon
1996-04-09  0:00                   ` Robert Dewar
1996-04-09  0:00                   ` Robert Dewar
1996-04-09  0:00                     ` Peter Seebach
1996-04-10  0:00                       ` Robert Dewar
1996-04-11  0:00                   ` Tom Wheeley
1996-04-11  0:00                     ` Robert A Duff
1996-04-12  0:00                       ` Tom Wheeley
1996-04-12  0:00                         ` Robert Dewar
1996-04-13  0:00                           ` Chuck Karish
1996-04-13  0:00                             ` Robert Dewar
1996-04-19  0:00                               ` Bradd W. Szonye
1996-04-19  0:00                                 ` David Emery
1996-04-19  0:00                                 ` Robert Dewar
1996-04-22  0:00                                   ` Peter Seebach
1996-04-23  0:00                                 ` Keith Thompson
1996-04-19  0:00                       ` Bradd W. Szonye
1996-04-19  0:00                         ` Robert A Duff
1996-04-20  0:00                           ` Bradd W. Szonye
1996-04-19  0:00                         ` Robert Dewar
1996-04-23  0:00                           ` Bradd W. Szonye
1996-04-11  0:00                     ` Robert Dewar
1996-04-08  0:00             ` Peter Seebach
1996-04-09  0:00               ` Robert Dewar
1996-04-09  0:00                 ` Kazimir Kylheku
1996-04-09  0:00                 ` Peter Seebach
1996-04-09  0:00             ` Robert I. Eachus
1996-04-09  0:00               ` Kazimir Kylheku
1996-04-09  0:00               ` Peter Seebach
1996-04-25  0:00               ` BLUE
1996-04-08  0:00         ` Peter Seebach
1996-04-08  0:00           ` Fergus Henderson
1996-04-08  0:00             ` Robert Dewar
1996-04-08  0:00               ` Kazimir Kylheku
1996-04-09  0:00                 ` Robert Dewar
1996-04-11  0:00                   ` Tom Wheeley
1996-04-11  0:00                     ` Kazimir Kylheku
1996-04-12  0:00                       ` Peter Seebach
1996-04-13  0:00                       ` Tom Wheeley
1996-04-09  0:00               ` Peter Seebach
1996-04-08  0:00             ` Peter Seebach
1996-04-09  0:00               ` Fergus Henderson
1996-04-09  0:00                 ` Robert Dewar
1996-04-09  0:00                   ` Kazimir Kylheku
1996-04-09  0:00               ` Fergus Henderson
1996-04-09  0:00                 ` Kenneth Mays
1996-04-10  0:00                   ` Fergus Henderson
1996-04-10  0:00                 ` Tom Payne
1996-04-09  0:00               ` Robert Dewar
1996-04-10  0:00             ` Steve Summit
1996-04-10  0:00               ` Robert Dewar
1996-04-08  0:00           ` Robert Dewar
1996-04-08  0:00             ` Kazimir Kylheku
1996-04-09  0:00               ` Robert Dewar
1996-04-09  0:00                 ` Kazimir Kylheku
1996-04-09  0:00                 ` Lawrence Kirby
1996-04-09  0:00                   ` Robert Dewar
1996-04-09  0:00                     ` Kazimir Kylheku
1996-04-10  0:00                       ` Robert Dewar
1996-04-10  0:00                         ` Kazimir Kylheku
1996-04-10  0:00                     ` David Emery
1996-04-09  0:00             ` Peter Seebach
1996-04-10  0:00             ` John Marshall
1996-04-10  0:00               ` Robert Dewar
1996-04-09  0:00           ` Steve Tynor
1996-04-09  0:00             ` Kazimir Kylheku
1996-04-10  0:00             ` Chet
1996-04-10  0:00               ` Robert Dewar
1996-04-10  0:00               ` Tom Watson
1996-04-10  0:00               ` Kazimir Kylheku
1996-04-10  0:00               ` Peter Seebach
1996-04-10  0:00             ` Lawrence Kirby
1996-04-12  0:00               ` Dr S.J. Harris
1996-04-12  0:00                 ` Peter Seebach
1996-04-12  0:00           ` Gareth Rees
1996-04-10  0:00         ` Tom Payne
1996-04-10  0:00         ` Matt Austern
1996-04-10  0:00           ` Robert Dewar
1996-04-07  0:00     ` Dan Pop
1996-04-07  0:00       ` Robert Dewar
1996-04-07  0:00     ` Lawrence Kirby
1996-04-07  0:00       ` Robert Dewar
1996-04-08  0:00         ` Peter Seebach
1996-04-08  0:00           ` Robert Dewar
1996-04-08  0:00             ` Peter Seebach
1996-04-09  0:00             ` Dan Pop
1996-04-09  0:00               ` James McIninch
1996-04-10  0:00                 ` Dan Pop
1996-04-09  0:00                   ` Danette & Murray Root
1996-04-11  0:00                 ` Tom Wheeley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox