Conversation
Otherwise it does not work correctly for dynamic buffers, see #78
include/rcutils/error_handling.h
Outdated
| } rcutils_error_state_t; | ||
|
|
||
| #define RCUTILS_SAFE_FWRITE_TO_STDERR(msg) fwrite(msg, sizeof(char), sizeof(msg), stderr) | ||
| #ifdef __STDC_LIB_EXT1__ || WIN32 |
There was a problem hiding this comment.
please use _WIN32 instead of WIN32 like the rest of the codebase
There was a problem hiding this comment.
Does this comparison ever evaluate to false ?
As it stands __STDC_LIB_EXT1__ is always defined isn't it ? or is string.h undefining it ?
There was a problem hiding this comment.
Note: @dhood is defining __STDC_WANT_LIB_EXT1__ above not __STDC_LIB_EXT1__, so my guess is string.h might set it.
There was a problem hiding this comment.
I see, it may deserve a comment to explain what's going on here
There was a problem hiding this comment.
I didnt know that modern GCC now accept boolean conditions on ifdef I remember always having to use #if defined for this kind of operation
There was a problem hiding this comment.
Yeah, that is odd, I wouldn't be surprised if that didn't do what your expecting.
include/rcutils/error_handling.h
Outdated
| #endif | ||
|
|
||
| #define __STDC_WANT_LIB_EXT1__ 1 // needed for `strnlen_s` | ||
| #include <string.h> |
include/rcutils/error_handling.h
Outdated
| } rcutils_error_state_t; | ||
|
|
||
| #define RCUTILS_SAFE_FWRITE_TO_STDERR(msg) fwrite(msg, sizeof(char), sizeof(msg), stderr) | ||
| #ifdef __STDC_LIB_EXT1__ || WIN32 |
There was a problem hiding this comment.
Note: @dhood is defining __STDC_WANT_LIB_EXT1__ above not __STDC_LIB_EXT1__, so my guess is string.h might set it.
|
Regarding
|
mikaelarguedas
left a comment
There was a problem hiding this comment.
thanks for iterating, lgtm now, with green ci
fixes #78
Otherwise it does not work correctly for dynamic buffers
CI forthcoming, at which point I'll put this into review once I'm sure it works cross-platform