Inline functions

This program uses the following two inline functions to accommodate leap years.

      static inline Boolean GMCisleap(int aYear)
      {
          int newYear = aYear;
              Boolean leaping = FALSE;
          
          if ( newYear < 100 )
              newYear += 1900;
      
          leaping = ( ( ( ( ( newYear )%4) == 0 && ( ( ( newYear ) %100 ) !=0 ) ) ||
              ( ( newYear ) %400 )==0 ) );
              
          return leaping;
      }
      
      static inline int GMCdaysInMonth( int m, int y )
      {
          if ( ( m==2 )&& GMCisleap( y ) )
              return 29;
          else
              return GMCmonthlengths[ m-1 ];
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker