mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 07:52:43 +01:00
See https://github.com/NixOS/nix/pull/8699#discussion_r1554312181 Casting a function pointer to `void*` is undefined behavior in the C spec, since there are platforms with different sizes for these two kinds of pointers. A safe alternative might be `void (*callback)()`
10 lines
185 B
C++
10 lines
185 B
C++
#include "string_callback.hh"
|
|
|
|
namespace nix::testing {
|
|
|
|
void observe_string_cb(const char * start, unsigned int n, std::string * user_data)
|
|
{
|
|
*user_data = std::string(start);
|
|
}
|
|
|
|
}
|