Replies: 3 comments 3 replies
-
I've never been able to come up with a solution that is ergonomic and reliable. It always seems to depend on the programmer to do the right thing, because the C or C++ language does not provide any mechanism to bind the length information and pointer together in a robust way. Yes the We could suggest that the programmer do something like: ace_time::CompleteZoneManager zoneManager(
sizeof(ace_time::zonedbc::kZoneAndLinkRegistry) /
sizeof(ace_time::zonedbc::kZoneAndLinkRegistry[0]),
ace_time::zonedbc::kZoneAndLinkRegistry,
zoneProcessorCache); This only works if the registry is a compile-time array. It does not work if it's passed in as a pointer. This also depends on the programmer to write the correct You could say that we should create a new class (let's call it a |
Beta Was this translation helpful? Give feedback.
-
I thought about changing |
Beta Was this translation helpful? Give feedback.
-
Found this answer on StackOverflow: https://stackoverflow.com/a/60151658/2404492 I guess this is what you meant as Sure, if the library user creates a custom registry, he would have to write the same code, but this change will reduce the number of users who can make a mistake, from all users of the library to only those who create their registries. Just a thought. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I found that if I create ZoneManager like this:
the code hangs up while trying to enumerate them later:
I understand it's technically not a bug within the library, but maybe there's a way to prevent incorrect size passing? The size of array
ace_time::zonedbc::kZoneAndLinkRegistry
is known at compile-time, so maybe it's possible to avoid passing its size directly?Beta Was this translation helpful? Give feedback.
All reactions