Purpose of _LINUX_EXPORT_H macro
Clash Royale CLAN TAG#URR8PPP
What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?
Link: _LINUX_EXPORT_H in torvalds/linux on github
linux kernel c
add a comment |
What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?
Link: _LINUX_EXPORT_H in torvalds/linux on github
linux kernel c
5
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
1
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04
add a comment |
What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?
Link: _LINUX_EXPORT_H in torvalds/linux on github
linux kernel c
What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?
Link: _LINUX_EXPORT_H in torvalds/linux on github
linux kernel c
linux kernel c
asked Mar 3 at 1:26
MartinMartin
111
111
5
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
1
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04
add a comment |
5
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
1
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04
5
5
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
1
1
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04
add a comment |
1 Answer
1
active
oldest
votes
If you look carefully at the file, it starts and ends with these lines:
#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */
These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.
These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h
has
#ifndef _PWD_H
#define _PWD_H 1
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504036%2fpurpose-of-linux-export-h-macro%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you look carefully at the file, it starts and ends with these lines:
#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */
These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.
These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h
has
#ifndef _PWD_H
#define _PWD_H 1
add a comment |
If you look carefully at the file, it starts and ends with these lines:
#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */
These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.
These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h
has
#ifndef _PWD_H
#define _PWD_H 1
add a comment |
If you look carefully at the file, it starts and ends with these lines:
#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */
These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.
These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h
has
#ifndef _PWD_H
#define _PWD_H 1
If you look carefully at the file, it starts and ends with these lines:
#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */
These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.
These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h
has
#ifndef _PWD_H
#define _PWD_H 1
edited Mar 3 at 14:23
Kusalananda♦
138k17258428
138k17258428
answered Mar 3 at 14:21
Stephen HarrisStephen Harris
27.1k35283
27.1k35283
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504036%2fpurpose-of-linux-export-h-macro%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
5
Are you asking about the purpose of include guards?
– steeldriver
Mar 3 at 1:39
1
It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.
– JdeBP
Mar 3 at 7:04