This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 11, tiny error, not quite a bug?

I'm not sure where to report this. SDK11/examples/peripheral/timer/main.c reads:

26 #include "bsp.h"
27
28 #include "nrf_drv_timer.h"
29 #include "bsp.h"

Line 29 duplicates the #include on line 26. The program builds with gcc -Wall as-is, and also when line 29 is commented out.

I have to wonder whether that would always be true, since gcc warnings tend to get pickier and pickier with each revision. (I know, the compiler authors are helping us by being so picky. Sometimes it just doesn't feel that way.)

Parents
  • header files almost always have the same boilerplate in them

    #ifndef SOME_MACRO_VAR
    #define SOME_MACRO_VAR
    
    .... code
    
    #endif
    

    in them so you can include them as many times as you want, or include other files which include them, which is the usual case, and it makes absolutely no difference at all because the second time through, or the third, or any time after the first, the entire thing is just skipped.

Reply
  • header files almost always have the same boilerplate in them

    #ifndef SOME_MACRO_VAR
    #define SOME_MACRO_VAR
    
    .... code
    
    #endif
    

    in them so you can include them as many times as you want, or include other files which include them, which is the usual case, and it makes absolutely no difference at all because the second time through, or the third, or any time after the first, the entire thing is just skipped.

Children
No Data
Related