[mod.std.c] mod.std.c Digest V16#16

osd@hou2d.UUCP (Orlando Sotomayor-Diaz) (05/15/86)

From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Thu, 15 May 86       Volume 16 : Issue  16

Today's Topics:
         MORE C standard differences Apr85-Feb86, part 6 of 9
----------------------------------------------------------------------

Date: 
From: ihnp4!utzoo!lsuc!msb
Subject: MORE C standard differences Apr85-Feb86, part 6 of 9
To: utzoo!ihnp4!hou2d!osd

# D.10.4.3 The getenv function

N-->   The array pointed to is not modifiable by the program, but may be
N-->   overwritten by a subsequent call to the getenv function.



# D.10.4.4 The onexit function

       If the registration succeeds, the onexit function returns a value
  *    that compares unequal to {--> the integer constant} 0.



# {--> D.10.5 Searching and sorting utilities}



# {--> D.10.5.1 The bsearch function}

N-->   Synopsis

N-->               #include <stdlib.h>
N-->               void *bsearch(const void *key, const void *base,
N-->                     size_t nel, size_t keysize,
N-->                     int (*compar)(const void *, const void *));

N-->   Description

N-->   The bsearch function searches an array of nel objects,  the  ini-
N-->   tial  member  of  which  is pointed to by base, for a member that
N-->   matches the object pointed to by key.  The size of each object is
N-->   specified by keysize.

N-->   The array shall be previously sorted in ascending order according
N-->   to  a  comparison  function pointed to by compar, which is called
N-->   with two arguments that point to the objects being compared.  The
N-->   function  shall return an integer less than, equal to, or greater
N-->   than zero if the first argument is considered to be  respectively
N-->   less than, equal to, or greater than the second.

N-->   Returns

N-->   The bsearch function returns a pointer to the matching member  of
N-->   the array, or a null pointer if no match is found.



# {--> D.10.5.2 The qsort function}

N-->   Synopsis

N-->               #include <stdlib.h>
N-->               void qsort(void *base, size_t nel, size_t keysize,
N-->                     int (*compar)(const void *, const void *));

N-->   Description

N-->   The qsort function sorts an array of  nel  objects,  the  initial
N-->   member  of  which is pointed to by base.  The size of each object
N-->   is specified by keysize.

N-->   The array is sorted in ascending order according to a  comparison
N-->   function pointed to by compar, which is called with two arguments
N-->   that point to the objects being compared.  The function shall re-
N-->   turn  an integer less than, equal to, or greater than zero if the
N-->   first argument is considered to be respectively less than,  equal
N-->   to, or greater than the second.

N-->   If two members compare as equal, their order in the sorted  array
N-->   is unspecified.

N-->   Returns

N-->   The qsort function returns no value.



# {--> D.10.6 Integer arithmetic functions}



# {D.5.6.1 --> D.10.6.1} The abs function

       ...
  *                #include {<math.h> --> <stdlib.h>}
       ...



# {--> D.10.6.2 The idiv function}

N-->   Synopsis

N-->               #include <stdlib.h>
N-->               idiv_t idiv(int numer, int denom);

N-->   Description

N-->   The idiv function computes the  quotient  and  remainder  of  the
N-->   division of the numerator numer by the denominator denom.  If the
N-->   division is inexact, the sign of the  quotient  is  that  of  the
N-->   mathematical  quotient,  and the magnitude of the quotient is the
N-->   largest integer less than the magnitude of the mathematical  quo-
N-->   tient.   If the result cannot be represented, the behavior is un-
N-->   defined.

N-->   Returns

N-->   The idiv function returns a structure with two elements: the quo-
N-->   tient and the remainder.  The type returned is defined by

N-->               typedef struct { int quot, rem; } idiv_t;



# {--> D.10.6.3 The ldiv function}

N-->   Synopsis

N-->               #include <stdlib.h>
N-->               ldiv_t ldiv(long numer, long denom);

N-->   Description

N-->   The ldiv function is similar to the idiv  function,  except  that
N-->   the  arguments  and  the members of the returned structure (which
N-->   has type ldiv_t) all have type long int.



# D.11 STRING HANDLING <string.h>

Remark: The memset and strlen functions are moved from  #D.11.2.2
and  #D.11.4.3,  respectively,  into #D.11.6, and the other func-
tions' sections in #D.11.2 and #D.11.4 are renumbered  according-
ly.



# D.11.1 String function conventions

       The header <string.h> declares several functions useful for mani-
  *    pulating character arrays {--> and other objects treated as char-
       acter arrays}.



# D.11.1 String function conventions

<--O   If copying takes place between objects that overlap, the behavior
<--O   is undefined.



# D.11.2.1 The memcpy function

  *    The memcpy function copies n characters from the {array  -->  ob-
  *    ject}  pointed to by s2 into the {array --> object} pointed to by
       s1.

Remark: This change is general through this section.



# D.11.2.1 The memcpy function

N-->   Copying between objects that overlap shall take place correctly.



# {D.11.2.3 --> D.11.2.2} The strcpy function

N-->   If copying takes place between objects that overlap, the behavior
N-->   is undefined.



# {D.11.2.4 --> D.11.2.3} The strncpy function

N-->   If copying takes place between objects that overlap, the behavior
N-->   is undefined.



# {D.11.2.4 --> D.11.2.3} The strncpy function

       If the string pointed to by s2 is longer than n  characters,  the
  *    result {may --> will} not be null-terminated.

------------------------------

End of mod.std.c Digest - Thu, 15 May 86 13:31:29 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.