Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the use of extern in Library/StdDriver/inc/fmc.h header file #33

Open
cy023 opened this issue Mar 2, 2023 · 2 comments

Comments

@cy023
Copy link

cy023 commented Mar 2, 2023

Hi there,

I have a question about the use of extern in the Library/StdDriver/inc/fmc.h header file. Specifically, I noticed that the extern keyword is used in function declarations. However, as far as I know, C already assumes extern by default when declaring functions.

I would like to understand why extern is used in these function declarations, and whether it is necessary.

Thanks in advance for any clarification you can provide!

@sadikthanos
Copy link

Hi @cy023 your observation is correct.

In C, function declarations are considered implicitly extern by default. When you declare a function in C, it is assumed to have external linkage, meaning that it can be accessed by other source files.

Rather I would believe that this might be an Coding style choice or just to maintain consistency in all of the declarations in the header files.

As it doesn't alter any functionality of that feels like just bathing in the rain :)

@ychuang3
Copy link
Contributor

A very interesting and apt metaphor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants