Re: A question regarding C string functions

Liste des GroupesRevenir à cl c 
Sujet : Re: A question regarding C string functions
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 02. Apr 2025, 19:33:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250402112547.50@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-04-02, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
I cannot find any definitive statement in my copies of the various
C language standards that addresses the behaviour of the C string
functions when given a NULL pointer.

Let us start with ISO C 90.

  7.1.7 Use of library functions
 
  Each of the following statements applies unless explicitly stated
  otherwise in the detailed descriptions that follow. If an argument to
  a function has an invalid value (such as a value outside the domain of
  the function. or a pointer outside the address space of the program.
  or a null pointer), the behavior is undefined.
  ^^^^^^^^^^^^^^^^^

C99 draft. (Have the real thing, not currently on me):

  7.1.4 Use of library functions

  1 Each of the following statements applies unless explicitly stated
    otherwise in the detailed descriptions that follow: If an argument
    to a function has an invalid value (such as a value outside the
    domain of the function, or a pointer outside the address space of
    the program, or a null pointer, or a pointer to non-modifiable
    storage when the corresponding parameter is not const-qualified) or
    a type (after promotion) not expected by a function with variable
    number of arguments, the behavior is undefined.

n3301 draft:

  7.1.4 Use of library functions

  1 Each of the following statements applies unless explicitly stated
    otherwise in the detailed descriptions that follow:

    -- If an argument to a function has an invalid value (such as a
       value outside the domain of the function, or a pointer outside
       the address space of the program, or a null pointer, or a pointer
       to non-modifiable storage when the corresponding parameter is not
       const-qualified) or a type (after default argument promotion) not
       expected by a function with a variable number of arguments, the
       behavior is undefined.

It gets more verbose and indented, but the null treatment is
consistently there.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
2 Apr 25 * A question regarding C string functions8Lew Pitcher
2 Apr 25 +* Re: A question regarding C string functions3Kaz Kylheku
2 Apr 25 i+- Re: A question regarding C string functions1Lew Pitcher
3 Apr 25 i`- Re: A question regarding C string functions1David Brown
3 Apr 25 +* Re: A question regarding C string functions3Tim Rentsch
3 Apr 25 i+- Re: A question regarding C string functions1Lew Pitcher
3 Apr 25 i`- Re: A question regarding C string functions1Ethan Carter
3 Apr 25 `- Re: A question regarding C string functions1James Kuyper

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal