You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "paul@wrada.com" <pa...@wrada.com> on 2016/03/28 23:03:20 UTC
include files with the same name
Hi all,
Just something I noticed here that I'll pass on to the group.
Mynewt has special directory structure to avoid name conflicts with header files. For example,
Hal/hal_adc.h
And
Mcu/hal_adc.h
won't conflict because the user has to include the directory name in the path.
#include <mcu/hal_adc.h>
#include <hal/hal_adc.h>
However, my editor conveniently creates the #ifndef __FNAME__ directives in the header files.
Without some care, the example above will have problems because they will both use
__HAL_ADC_H__ as their include prefix.
I think by convention we can fix this with using a longer namespace in the header includes.
#ifdef __MCU_HAL_ADC_H__
#ifdef __HAL_HAL_ADC_H__
Paul