Changeset 7f6e9eb
- Timestamp:
- Aug 11, 2020, 2:58:26 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5bcdc8c
- Parents:
- 7ed1d8f
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseargs.cfa
r7ed1d8f r7f6e9eb 19 19 extern long long int strtoll (const char* str, char** endptr, int base); 20 20 extern unsigned long long int strtoull(const char* str, char** endptr, int base); 21 extern double strtod (const char* str, char** endptr); 21 22 } 22 23 … … 162 163 } 163 164 165 bool parse(const char * arg, int & value) { 166 char * end; 167 int r = strtoll(arg, &end, 10); 168 if(*end != '\0') return false; 169 170 value = r; 171 return true; 172 } 173 164 174 bool parse(const char * arg, unsigned & value) { 165 175 char * end; … … 182 192 } 183 193 184 bool parse(const char * arg, int& value) {185 char * end; 186 int r = strtoll(arg, &end, 10);187 if(*end != '\0') return false; 188 189 value = r; 190 return true; 191 } 194 bool parse(const char * arg, double & value) { 195 char * end; 196 double r = strtod(arg, &end); 197 if(*end != '\0') return false; 198 199 value = r; 200 return true; 201 } -
libcfa/src/parseargs.hfa
r7ed1d8f r7f6e9eb 38 38 39 39 bool parse(const char *, const char * & ); 40 bool parse(const char *, int & ); 40 41 bool parse(const char *, unsigned & ); 41 42 bool parse(const char *, size_t & ); 42 bool parse(const char *, int& );43 bool parse(const char *, double & );
Note: See TracChangeset
for help on using the changeset viewer.