Skip to content

Commit

Permalink
TODO: about replacing strtoull
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Aug 2, 2021
1 parent 5a0cf5f commit cacbfd9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ bool flag_parse(int argc, char **argv)

static_assert(sizeof(unsigned long long int) == sizeof(uint64_t), "The original author designed this for x86_64 machine with the compiler that expects unsigned long long int and uint64_t to be the same thing, so they could use strtoull() function to parse it. Please adjust this code for your case and maybe even send the patch to upstream to make it work on a wider range of environments.");
char *endptr;
// TODO: replace strtoull with a custom solution
// That way we can get rid of the dependency on errno and static_assert
unsigned long long int result = strtoull(arg, &endptr, 10);

if (arg == endptr || *endptr != '\0') {
Expand Down

0 comments on commit cacbfd9

Please sign in to comment.