mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-04-30 19:09:19 +08:00
lint
This commit is contained in:
parent
ec664092eb
commit
c99403b8af
@ -1,5 +1,5 @@
|
||||
#ifndef __FAST_FLOAT_STRTOD_H__
|
||||
#define __FAST_FLOAT_STRTOD_H__
|
||||
#ifndef FAST_FLOAT_STRTOD_H__
|
||||
#define FAST_FLOAT_STRTOD_H__
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
@ -28,4 +28,4 @@ double fast_float_strtod(const char *in, char **out);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FAST_FLOAT_STRTOD_H__ */
|
||||
#endif /* FAST_FLOAT_STRTOD_H__ */
|
||||
@ -1,7 +1,7 @@
|
||||
add_library(fast_float_strtod STATIC fast_float_strtod.cpp)
|
||||
target_link_libraries(fast_float_strtod PRIVATE fast_float)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND NOT WIN32)
|
||||
target_link_options(fast_float_strtod PRIVATE -nostdlib++)
|
||||
endif()
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ add_subdirectory(build_tests)
|
||||
add_subdirectory(bloat_analysis)
|
||||
|
||||
add_executable(strtod_test strtod_test.c)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND NOT WIN32)
|
||||
target_link_options(strtod_test PUBLIC -nostdlib++)
|
||||
endif()
|
||||
target_link_libraries(strtod_test PUBLIC fast_float_strtod)
|
||||
|
||||
@ -4,25 +4,25 @@
|
||||
#include <errno.h>
|
||||
|
||||
int main() {
|
||||
// Test successful conversion
|
||||
const char *str1 = "3.14159";
|
||||
char *end1;
|
||||
errno = 0;
|
||||
double d1 = fast_float_strtod(str1, &end1);
|
||||
printf("Input: %s\n", str1);
|
||||
printf("Converted: %f\n", d1);
|
||||
printf("End pointer: %s\n", end1);
|
||||
printf("errno: %d\n", errno);
|
||||
// Test successful conversion
|
||||
const char *str1 = "3.14159";
|
||||
char *end1;
|
||||
errno = 0;
|
||||
double d1 = fast_float_strtod(str1, &end1);
|
||||
printf("Input: %s\n", str1);
|
||||
printf("Converted: %f\n", d1);
|
||||
printf("End pointer: %s\n", end1);
|
||||
printf("errno: %d\n", errno);
|
||||
|
||||
// Test invalid input
|
||||
const char *str2 = "invalid";
|
||||
char *end2;
|
||||
errno = 0;
|
||||
double d2 = fast_float_strtod(str2, &end2);
|
||||
printf("\nInput: %s\n", str2);
|
||||
printf("Converted: %f\n", d2);
|
||||
printf("End pointer: %s\n", end2);
|
||||
printf("errno: %d\n", errno);
|
||||
// Test invalid input
|
||||
const char *str2 = "invalid";
|
||||
char *end2;
|
||||
errno = 0;
|
||||
double d2 = fast_float_strtod(str2, &end2);
|
||||
printf("\nInput: %s\n", str2);
|
||||
printf("Converted: %f\n", d2);
|
||||
printf("End pointer: %s\n", end2);
|
||||
printf("errno: %d\n", errno);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user