Hi,

Yes compiler do not optimize (remove out) empty function defined as is 
suggested.
But if RIOT does not want use macros, we can define empty function as static 
inline function in header and then will be removed by optimization.

log_api.h

#if MODULE_LOG
void log_info(...);
#else
static inline void log_info(...) {}
#endif


BTW. Hauke idea use modules is nice.

Regards,
Jozef





> On 23 Feb 2015, at 13:00, Martine Lenders <authmille...@gmail.com> wrote:
> 
> Hi,
> 
> Am 23.02.2015 10:04 schrieb "Ludwig Ortmann" <ludwig.ortm...@fu-berlin.de>:
> > are you suggesting macros are better than APIs + functions?
> > If so, please explain why and what better means ;)
> 
> I was not sure if the compiler optimizes out empty functions, so I assumed
> 
> #define INFO(msg) (void)0;
> 
> to be the better solution concerning code size.
> 
> Regards, 
> Martine
> _______________________________________________
> devel mailing list
> devel@riot-os.org
> http://lists.riot-os.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
devel@riot-os.org
http://lists.riot-os.org/mailman/listinfo/devel

Reply via email to