Ignore:
Timestamp:
Aug 31, 2021, 1:49:09 AM (3 years ago)
Author:
Jacob Prud'homme <jafprudhomme@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
716e4e6
Parents:
6604ea1
git-author:
Jacob Prud'homme <jafprudhomme@…> (07/16/21 15:36:51)
git-committer:
Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:09)
Message:

Added some basic examples of validation functions

And rearranged the ordering of some declarations to avoid errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/parseconfig.cfa

    r6604ea1 r930609e2  
    115115
    116116
     117// *********************************** validation ***********************************
     118
     119
     120forall(T | arithmetic( T ))
     121bool is_nonnegative( T & value ) {
     122        T zero_val = 0;
     123        return value >= zero_val;
     124}
     125
     126forall(T | arithmetic( T ))
     127bool is_positive( T & value ) {
     128        T zero_val = 0;
     129        return value > zero_val;
     130}
     131
     132forall(T | arithmetic( T ))
     133bool is_nonpositive( T & value ) {
     134        T zero_val = 0;
     135        return value <= zero_val;
     136}
     137
     138forall(T | arithmetic( T ))
     139bool is_negative( T & value ) {
     140        T zero_val = 0;
     141        return value < zero_val;
     142}
     143
     144
    117145// Local Variables: //
    118146// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.