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

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  15

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

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

# D.10.1.1 The atof function

<--O   If the value cannot be represented, the  behavior  is  undefined.
<--O   It  the string starts with an unrecognized character, zero is re-
<--O   turned.

Remark: And likewise for atoi (#D.10.1.2) and atol (#D.10.1.3).



# D.10.1.2 The atoi function

<--O   The function recognizes an optional sequence of white-space char-
<--O   acters,  then  an optional plus or minus sign, then a sequence of
<--O   digits.  The first unrecognized character  ends  the  conversion.
<--O   The  sequence of digits is interpreted by the same rules as for a
<--O   decimal integer constant.

N-->   Except for the behavior on error, it is equivalent to

N-->               (int)strtol(nptr, (char **)NULL, 10)

N-->   ...  Forward references: the strtol function (#D.10.1.5).

Remark: Likewise for atol (#D.10.1.3), except with no (int) cast.



# D.10.1.4 The strtod function

       The function recognizes an optional leading  sequence  of  white-
  *    space  characters  {-->  (as specified by the isspace function)},
       ...

N-->   If an unrecognized character occurs before the first  digit  fol-
N-->   lowing the e or E, the exponent is taken to be zero.  ...

  *    If {the string starts with -->} an  unrecognized  character  {-->
  *    occurs before any digit}, zero is returned {-->, and errno is set
       to EDOM}.



# D.10.1.4 The strtod function

<--O   The string is interpreted by the same rules as  a  floating  con-
<--O   stant.

N-->   The sequence of characters from the first digit  or  the  decimal
N-->   point  (whichever occurs first) to the character before the first
N-->   unrecognized character is interpreted as a floating constant  ac-
N-->   cording  to  the rules of #C.1.3.1, except that if neither an ex-
N-->   ponent part nor a decimal point appears, a decimal point  is  as-
N-->   sumed  to  follow  the last digit in the string.  If a minus sign
N-->   appears immediately before the first digit, the  value  resulting
N-->   from the conversion is negated.



# D.10.1.5 The strtol function

       The function recognizes an optional leading  sequence  of  white-
  *    space  characters  {-->  (as specified by the isspace function)},
       ...

  *    If {the string starts with -->} an  unrecognized  character  {-->
       occurs  before the first recognized digit or letter}, zero is re-
  *    turned {-->, and errno is set to EDOM}.



# D.10.1.5 The strtol function

  *    If the value of base is 0, the sequence of {digits --> characters
       from  the  first digit to the character before the first unrecog-
  *    nized character} is interpreted {by the same rules -->}  as  {for
  *    -->}   an  integer  constant  {-->  according  to  the  rules  of
  *    #C.1.3.2}.  {After the optional sign, a  leading  zero  indicates
       octal  conversion, and a leading 0x or 0X hexadecimal conversion.
       Otherwise, decimal conversion is used.  --> If a minus  sign  ap-
       pears  immediately  before  the  first digit, the value resulting
       from the conversion is negated.}

       If the value of base is between 2 and 36, it is used as the  base
  *    for  conversion.  {--> Letters from a (or A) through z (or Z) are
       ascribed the values 10 to 35; a letter  whose  value  is  greater
       than  or equal to the value of base ends the conversion.} Leading
  *    zeros after the optional sign are ignored, and {-->  leading}  0x
  *    or  0X  is  ignored  if the value of base is 16.  {--> If a minus
       sign appears immediately before the first digit  or  letter,  the
       value resulting from the conversion is negated.}



# D.10.2.1 The rand function

       The rand function computes a sequence of  pseudo-random  integers
  *    in  the  range  0  to  {32767  --> RAND_MAX} {using the specified
       linear multiplicative algorithm, which has a period of  2  raised
       to the power 32 -->}.



# D.10.2.1 The rand function

  *    The following functions define  {the  required  semantics  -->  a
       portable implementation} of rand and srand.  ...

  *                int rand({--> void})

       ...

<--O               void srand(seed)
<--O                    unsigned int seed;

N-->               void srand(unsigned int seed)



# D.10.3 Memory management functions

N-->   The pointer returned  if  the  allocation  succeeds  is  suitably
N-->   aligned  so  that  it may be assigned to a pointer to any type of
N-->   object and then used to access such an object in the space  allo-
N-->   cated (until the space is explicitly freed or reallocated).



# D.10.3.1 The calloc function

  *                void *calloc({unsigned int --> size_t} nelem,
                         size_t size);



# D.10.3.1 The calloc function

<--O   The pointer returned may safely be case to point to an object  of
<--O   any type.

Remark: Likewise for malloc (#D.10.3.3) and realloc (#D.10.3.4).



# D.10.3.1 The calloc function

  *    If the space cannot be allocated, {--> or if  nelem  or  size  is
       zero,} the calloc function returns a null pointer.



# D.10.3.2 The free function

N-->   If ptr is a null pointer, no action occurs.



# D.10.3.4 The realloc function

N-->   If ptr is a null pointer, the realloc function behaves  like  the
N-->   malloc function for the specified size.  ...

       If size is zero, the realloc function returns a null pointer  and
       the object pointed to by ptr is freed.



# D.10.4.1 The abort function

  *    Unless the signal SIGABRT is being {--> cuaght or}  ignored,  the
       abort function causes abnormal program termination to occur.



# D.10.4.1 The abort function

       If the signal SIGABRT is being ignored, the  abort  function  re-
  *    turns no value.  {--> Otherwise, the abort function cannot return
       to its caller.}

Remark: I assume "caught or ignored" is meant.



# D.10.4.2 The exit function

<--O   If a registered function fails to return as its value  the  value
<--O   returned  by the call to the onexit function by means of which it
<--O   was registered, the behavior is undefined.

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

End of mod.std.c Digest - Thu, 15 May 86 13:31:09 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.