user54718: Is there any particular reason why #pragma once doesn't seem to be used in Arduino code? Is this just because it's not a well-known feature, or is there some overriding reason to use #ifndef XXX_H/#define XXX_H/#endif?

user4143: #pragma once operates on the absolute filename of a file. Include guards work on the content of the file.
If you have multiple copies of the same library (maybe one library has some parts of another included in it - it happens...) #pragma once would have no hope of working right.
Add to that the fact that the Arduino IDE copies some files around the place when building and '#pragma once is pretty much screwed.
Include guards work regardless. So sensible people use include guards and shun #pragma once.

54718: <p>Is there any particular reason why <code>#pragma once</code> doesn't seem to be used in Arduino code? Is this just because it's not a well-known feature, or is there some overriding reason to use <code>#ifndef XXX_H</code>/<code>#define XXX_H</code>/<code>#endif</code>?</p>
 4143: <p><code>#pragma once</code> operates on the absolute filename of a file. Include guards work on the content of the file.</p>

<p>If you have multiple copies of the same library (maybe one library has some parts of another included in it - it happens...) <code>#pragma once</code> would have no hope of working right.</p>

<p>Add to that the fact that the Arduino IDE copies some files around the place when building and <code>'#pragma once</code> is pretty much screwed.</p>

<p>Include guards work regardless. So sensible people use include guards and shun <code>#pragma once</code>.</p>
