Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

HP C

HP C
Language Reference Manual


Previous Contents Index

double difftime(time_t time1, time_t time0);

  • Returns the difference between the two calendar times time1 and time0, expressed in seconds, as a double.

time_t mktime(struct tm *timeptr);

  • Converts the broken-down time, expressed as local time, in the structure pointed to by timeptr into a calendar time value with the same encoding as that of the values returned by the time function (that is, a value of type time_t), which it returns. If the calendar time cannot be represented, the value (time_t)-1 is returned.
    The original values of the tm_wday and tm_yday time components are ignored, and the original values of the other components are not restricted to the ranges indicated in the previous discussion of struct_tm. Upon successful completion of the function, the values of the tm_wday and tm_yday components are set appropriately, and the other components are set to represent the specified calendar time, but with their values forced to the ranges indicated in the discussion of struct_tm. The final value of tm_wday is not set until tm_mon and tm_year are determined.

time_t time(time_t *timer);

  • Returns the current calendar time. If the calendar time is not available, the value (time_t)-1 is returned.


Appendix A
Language Syntax Summary

This section summarizes the syntax of the C language, using the syntax of the ANSI C Standard. Syntactic categories are indicated with bold type, and literal words or characters are indicated with monospaced, nonitalicized type. A colon following a syntactic category introduces its definition. Alternative definitions are listed on separate lines, or are prefaced by the words "one of." An optional element is indicated by the subscript opt. For example, the following line indicates an optional expression enclosed in braces:

{ expressionopt } 

The section numbers shown in parentheses refer to the section of the American National Standard for Information Systems-Programming Language C (document number: X3.159-1989) that discusses that part of the language.

A.1 Lexical Grammar

A.1.1 Tokens


token: (§3.1) 

  • keyword
  • identifier
  • constant
  • string-literal
  • operator
  • punctuator


preprocessing-token: (§3.1) 

  • header-name
  • identifier
  • pp-number
  • character-constant
  • string-literal
  • operator
  • punctuator
  • each nonwhite-space character that cannot be one of the above

A.1.2 Keywords


keyword: (§3.1.1) one of 


    auto        double      int         struct 
    break       else        long        switch 
    case        enum        register    typedef 
    char        extern      return      union 
    const       float       short       unsigned 
    continue    for         signed      void 
    default     goto        sizeof      volatile 
    do          if          static      while   
    _Bool      _Complex (ALPHA, I64)

A.1.3 Identifiers


identifier: (§3.1.2) 

  • identifier-nondigit
  • identifier identifier-nondigit
  • identifier digit


identifier-nondigit:

  • nondigit
  • other implementation-defined characters


nondigit: §3.1.2 one of 


    a  b  c  d  e  f  g  h  i  j  k  l  m 
    n  o  p  q  r  s  t  u  v  w  x  y  z 
    A  B  C  D  E  F  G  H  I  J  K  L  M 
    N  O  P  Q  R  S  T  U  V  W  X  Y  Z  _ 

digit:  (§3.1.2) one of 


    0  1  2  3  4  5  6  7  8  9 

A.1.4 Constants


constant: (§3.1.3) 

  • floating-constant
  • integer-constant
  • enumeration-constant
  • character-constant


floating-constant: (§3.1.3.1) 

  • decimal-floating-constant
  • hexadecimal-floating-constant


decimal-floating-constant

  • fractional-constant exponent-partopt floating-suffixopt
  • digit-sequence exponent-part floating-suffixopt


hexadecimal-floating-constant

  • hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-suffixopt
  • hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-suffixopt


fractional-constant: (§3.1.3.1) 

  • digit-sequenceopt . digit-sequence
  • digit-sequence .


exponent-part: (§3.1.3.1) 

  • e signopt digit-sequence
  • E signopt digit-sequence


sign: (§3.1.3.1)  one of 

  • + -


digit-sequence: (§3.1.3.1) 

  • digit
  • digit-sequence digit


hexadecimal-fractional-constant:

  • hexadecimal-digit-sequenceopt . hexadecimal-digit-sequence
  • hexadecimal-digit-sequence .


binary-exponent-part:

  • p signopt digit-sequence
  • P signopt digit-sequence


hexadecimal-digit-sequence:

  • hexadecimal-digit
  • hexadecimal-digit-sequence hexadecimal-digit


floating-suffix: (§3.1.3.1)  one of 

  • f l F L

integer-constant: (§3.1.3.2) 

  • decimal-constant integer-suffixopt
  • octal-constant integer-suffixopt
  • hexadecimal-constant integer-suffixopt


decimal-constant: (§3.1.3.2) 

  • nonzero-digit
  • decimal-constant digit


octal-constant: (§3.1.3.2) 

  • 0
  • octal-constant octal-digit


hexadecimal-constant: (§3.1.3.2) 

  • 0x hexadecimal-digit
  • 0X hexadecimal-digit
  • hexadecimal-constant hexadecimal-digit


nonzero-digit: (§3.1.3.2) one of 


    1  2  3  4  5  6  7  8  9 

octal-digit: (§3.1.3.2) one of 


    0  1  2  3  4  5  6  7 

hexadecimal-digit: (§3.1.3.2) one of 


    0  1  2  3  4  5  6  7  8  9 
    a  b  c  d  e  f 
    A  B  C  D  E  F 

integer-suffix: (§3.1.3.2) 

  • unsigned-suffix long-suffixopt
  • long-suffix unsigned-suffixopt


unsigned-suffix: (§3.1.3.2) one of 

  • u U

long-suffix: (§3.1.3.2) one of 

  • l L

enumeration-constant: (§3.1.3.3) 

  • identifier


character-constant: (§3.1.3.4) 

  • ' c-char-sequence'
  • L' c-char-sequence'


c-char-sequence: (§3.1.3.4) 

  • c-char
  • c-char-sequence c-char


c-char: (§3.1.3.4) 

  • any member of the source character set except
    the single-quote ('), backslash (\), or new-line character
  • escape-sequence


escape-sequence: (§3.1.3.4) 

  • simple-escape-sequence
  • octal-escape-sequence
  • hexadecimal-escape-sequence


simple-escape-sequence: (§3.1.3.4) one of 


    \'  \"  \?  \\
    \a  \b  \f  \n  \r  \t  \v 

octal-escape-sequence: (§3.1.3.4) 

  • \ octal-digit
  • \ octal-digit octal-digit
  • \ octal-digit octal-digit octal-digit


hexadecimal-escape-sequence:(§3.1.3.4) 

  • \x hexadecimal-digit
  • hexadecimal-escape-sequence hexadecimal-digit

A.1.5 String Literals


string-literal: (§3.1.4) 

  • "s-char-sequenceopt"
  • L"s-char-sequenceopt"


s-char-sequence: (§3.1.4) 

  • s-char
  • s-char-sequence s-char


s-char: (§3.1.4) 

  • any member of the source character set except
    the double-quote ("), backslash (\), or new-line character
  • escape-sequence

A.1.6 Operators


operator: (§3.1.5) one of 


    [  ]  (  )  .  -> 
    ++  --  &  *  +  -  ~  !  sizeof 
    /  %  <<  >>  <  >  <=  >=  ==  !=  ^  |  &&  || 
    ?  : 
    =  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |= 
    ,  #  ## 

A.1.7 Punctuators


punctuator: (§3.1.6) one of 


    [  ]  (  )  {  }  *  ,  :  =  ;  ...  # 

A.1.8 Header Names


header-name: (§3.1.7) 

  • <h-char-sequence>
  • "q-char-sequence"


h-char-sequence: (§3.1.7) 

  • h-char
  • h-char-sequence h-char


h-char: (§3.1.7) 

  • any member of the source character set except
    the new-line character and >


q-char-sequence: (§3.1.7) 

  • q-char
  • q-char-sequence q-char


q-char: (§3.1.7) 

  • any member of the source character set except
    the new-line character and "

A.1.9 Preprocessing Numbers


pp-number: (§3.1.8) 

  • digit
  • . digit
  • pp-number digit
  • pp-number nondigit
  • pp-number e sign
  • pp-number E sign
  • pp-number .

A.2 Phrase Structure Grammar

A.2.1 Expressions


primary-expression: (§3.3.1) 

  • identifier
  • constant
  • string-literal
  • ( expression )


postfix-expression: (§3.3.2) 

  • primary-expression
  • postfix-expression [ expression ]
  • postfix-expression ( argument-expression-listopt )
  • postfix-expression . identifier
  • postfix-expression -> identifier
  • postfix-expression ++
  • postfix-expression - -


argument-expression-list: (§3.3.2) 

  • assignment-expression
  • argument-expression-list , assignment-expression


unary-expression: (§3.3.3) 

  • postfix-expression
  • ++ unary-expression
  • - - unary-expression
  • unary-operator cast-expression
  • sizeof unary-expression
  • sizeof ( type-name )


unary-operator: (§3.3.3) one of 


    &  *  +  -  ~  ! 

cast-expression: (§3.3.4) 

  • unary-expression
  • ( type-name ) cast-expression


multiplicative-expression: (§3.3.5) 

  • cast-expression
  • multiplicative-expression * cast-expression
  • multiplicative-expression / cast-expression
  • multiplicative-expression % cast-expression


additive-expression: (§3.3.6) 

  • multiplicative-expression
  • additive-expression + multiplicative-expression
  • additive-expression - multiplicative-expression


shift-expression: (§3.3.7) 

  • additive-expression
  • shift-expression << additive-expression
  • shift-expression >> additive-expression


relational-expression: (§3.3.8) 

  • shift-expression
  • relational-expression < shift-expression
  • relational-expression > shift-expression
  • relational-expression <= shift-expression
  • relational-expression >= shift-expression


equality-expression: (§3.3.9) 

  • relational-expression
  • equality-expression :=,= relational-expression
  • equality-expression != relational-expression


AND-expression: (§3.3.10) 

  • equality-expression
  • AND-expression & equality-expression


exclusive-OR-expression: (§3.3.11) 

  • AND-expression
  • exclusive-OR-expression ^ AND-expression


inclusive-OR-expression: (§3.3.12) 

  • exclusive-OR-expression
  • inclusive-OR-expression | exclusive-OR-expression


logical-AND-expression: (§3.3.13) 

  • inclusive-OR-expression
  • logical-AND-expression && inclusive-OR-expression


logical-OR-expression: (§3.3.14) 

  • logical-AND-expression
  • logical-OR-expression || logical-AND-expression


conditional-expression: (§3.3.15) 

  • logical-OR-expression
  • logical-OR-expression ? expression : conditional-expression


assignment-expression: (§3.3.16) 

  • conditional-expression
  • unary-expression assignment-operator assignment-expression


assignment-operator: (§3.3.16) one of 


    =  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |= 

expression: (§3.3.17) 

  • assignment-expression
  • expression , assignment-expression


constant-expression: (§3.4) 

  • conditional-expression


Previous Next Contents Index

Privacy statement Using this site means you accept its terms
© 2007 Hewlett-Packard Development Company, L.P.