bshell.runtime: add a compiler option for disabling floating-point usage
This commit is contained in:
@@ -24,5 +24,6 @@ endif ()
|
||||
target_include_directories(bshell.runtime PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_compile_definitions(bshell.runtime PUBLIC
|
||||
BSHELL_VERSION="${bshell_version}"
|
||||
BSHELL_ENABLE_FLOATING_POINT=${bshell_enable_floating_point}
|
||||
BSHELL_INTERACTIVE=${bshell_interactive}
|
||||
BSHELL_VERBOSE=${bshell_verbose})
|
||||
|
||||
@@ -653,6 +653,7 @@ bool string_is_valid_number(
|
||||
}
|
||||
|
||||
char *ep = NULL;
|
||||
#if BSHELL_ENABLE_FLOATING_POINT == 1
|
||||
double dvalue = strtod(s, &ep);
|
||||
if (string_could_be_double(s) && *ep == '\0') {
|
||||
if (out) {
|
||||
@@ -665,6 +666,7 @@ bool string_is_valid_number(
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
int base = get_int_base_by_prefix(&s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user