Not sure if this is the correct approach.. if the compile flag just removes an function, why should we then have that compile flag? If the function is not called then the linker can strip out the code. Note that this does not work for compile flags in the control flow..
But if this is going to be stubbed: Can we have then an print message in the stubbed function which compile options needs to be used to enable the feature? Kind Regards, Wouter From: iotivity-dev-bounces at lists.iotivity.org [mailto:[email protected]] On Behalf Of ??? (Uze Choi) Sent: 07 April 2017 07:20 To: 'Junghyun Oh' <jhvics1 at gmail.com>; 'Mats Wichmann' <mats at wichmann.us> Cc: 'IoTivity Developer List' <iotivity-dev at lists.iotivity.org> Subject: Re: [dev] C API: conditional code I prefer this concept also. We can apply this rule in case of invalid parameter for specific compile option. Then, in case of bool/void return, how can we return ?not implemented? error code? BR, Uze Choi From: iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces at lists.iotivity.org> [mailto:[email protected]] On Behalf Of Junghyun Oh Sent: Friday, April 07, 2017 1:57 PM To: Mats Wichmann Cc: IoTivity Developer List Subject: Re: [dev] C API: conditional code +1 on "stub out functions if they don't apply " 2017. 4. 6. ?? 11:27? "Mats Wichmann" <mats at wichmann.us<mailto:mats at wichmann.us>>?? ??: Some of the code that *is* in the C API is bracketed in conditional compilation. For example, ocpayload.h has: #ifdef __WITH_TLS__ bool OCRepPayloadSetPropPubDataType(OCRepPayload *payload, const char *name, const OicSecKey_t *value); bool OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *name, const OicSecKey_t *value); bool OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *name, OicSecKey_t *value); #endif I'm not really fond of the idea that the API has different components depending on how the stack has been compiled. Do we want to do this? Or is it better to stub out functions if they don't apply - that is, the above three would be present but return some form of "not implemented" error if called? _______________________________________________ iotivity-dev mailing list iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org> https://lists.iotivity.org/mailman/listinfo/iotivity-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20170407/506bf221/attachment.html>
