2020/11/25 17:52:14
mian.qi

my questions are:
1. Which "#endif" corresponds to which "#inndef"?
2. What does "extern "C" " mean?
3. There was a "#endif" just after "{" and "}", what do they mean?
 

Attached Image(s)

2020/11/25 18:09:09
malaugh
First the matching
 
The #ifndef CONFIGURE_H matches the #endif at the bottom of the file
The other #ifdefs match with the #endif 2 line below them
 
Some explanations
 
#ifdef CONFIGURE_H is there to make sure the heaader file is not included twice
for example if your code is
#include "configure.h"
#include "configure.h"
The second inlcude will be ignored because CONFIGURE_H was defined by the first include, and the #ifndef CONFIGURE_H will be false, so nothing will be included.
 
The #ifdef __cplusplus is there to make sure that if the initilaizePeripherals function is part of a c++ application, the compiler knows this is a C function.
 
 
 
 
 
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account