-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cxx::function_ref
, cxx::function
and cxx::unique_ptr
should not be nullable
#1104
Comments
@elfenpiff Agree for This is similar to Please remove this requirement from the issue as it limits useful designs and deviates more from the STL unnecessarily. |
@MatthiasKillat if |
@elfenpiff I'm unsure if we should pursue this goal. I completely understand your intentions behind and even agree on them. However, we aim for Have a look at Folly's implemenation or at GNU's, both allow a nullable |
@elBoberido @MatthiasKillat @mossmaurice what about the following approach. We create a generic free function which fits every interface and looks like: template<typename ReturnType, typename... Arguments>
ReturnType genericEmptyFunction(Arguments&&...) {} This function is by default always set for But then I would also remove the |
@mossmaurice Having a nullable You are right, we aim for But here I have to remind you, that @MatthiasKillat @mossmaurice @elfenpiff reviewed #1094 and none of us experienced developers did catch this - I just caught it by accident when I performed my final review. Having nullable types is dangerous and this PR proofed it and we are working in a safety critical environment! |
@mossmaurice Here are the design goals of Folly (taken from the Readme)
It reads to me that constructs are may more error prone or harder to use to just get more performance out. This is not something we should take inspiration from for safety critical systems!
|
@mossmaurice as library developer we must be even more careful to provide constructs which cannot easily be used in a dangerous way, especially in out domain. With a null-able BTW, when it comes to performance nothing beats |
@elBoberido I totally agree with |
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
…o avoid null-ability Signed-off-by: Simon Hoinkis <[email protected]>
…o avoid null-ability Signed-off-by: Simon Hoinkis <[email protected]>
…m-function-ref iox-#1104 Remove null-ability from `cxx::function_ref`
reopen since |
…gration into iceoryx_hoofs Signed-off-by: Christian Eltzschig <[email protected]>
…tegrate it in hoofs Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
…gration into iceoryx_hoofs Signed-off-by: Christian Eltzschig <[email protected]>
…tegrate it in hoofs Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
…e argument Signed-off-by: Christian Eltzschig <[email protected]>
…gration into iceoryx_hoofs Signed-off-by: Christian Eltzschig <[email protected]>
…tegrate it in hoofs Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
…e argument Signed-off-by: Christian Eltzschig <[email protected]>
…ions to make behavior more clear, fix move in copy issue Signed-off-by: Christian Eltzschig <[email protected]>
…ions to make behavior more clear, fix move in copy issue Signed-off-by: Christian Eltzschig <[email protected]>
Signed-off-by: Christian Eltzschig <[email protected]>
Brief feature description
The feature of a nullable
function_ref
andfunction
can lead to a very easy misuse since one has to always check thefunction
/function_ref
if it is set before using it.This causes:
If one would like to have a nullable
function
/function_ref
one can always wrap this intocxx::optional
to make it clear that this is maybe null.That this can happen very easily is demonstrated in the approved PR: #1094 (comment)
ToDo:
function_ref
function
unique_ptr
The text was updated successfully, but these errors were encountered: