You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by MULDER Frank Willem <fr...@nl.thalesgroup.com> on 2011/08/30 14:03:10 UTC

pointer parameters

Hello,

                I have been using some functions, from the celix API, that return pointers. E.g.

                                SERVICE_REFERENCE ref = NULL;
                                celix_status_t status = bundleContext_getServiceReferences(..., &ref);

                Currently it is needed that the content of the ref pointer is NULL, otherwise the function gives an illegal argument status.

                I wonder whether the function should not return the ref pointer, regardless whether it is set to NULL. In that case it overwrites the actual value of the pointer. Maybe this is more like expected behaviour.

Gr. Frank



------------------------------------------------------------------------------------------------------------
Disclaimer:

If you are not the intended recipient of this email, please notify the sender and delete it. 
Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden. 
Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s). 
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------



Re: pointer parameters

Posted by Alexander Broekhuis <a....@gmail.com>.
Hi,


>                I wonder whether the function should not return the ref
> pointer, regardless whether it is set to NULL. In that case it overwrites
> the actual value of the pointer. Maybe this is more like expected behaviour.


Hmm not sure what to expect here, requiring the pointer to be set to NULL is
a clear trigger that something is wrong if an already used reference is
passed. Using clear error handling normally would make this easy to find.

Also a response to your question regarding error messages for the return
codes, if this is in place it can be used to detect such problems. So yes it
has to be added, feel free to add an issue.

I will see if I can add the basic code for this, so that only the list of
messages has to be extended.

-- 
Met vriendelijke groet,

Alexander Broekhuis