Add #pragma once
What this PR does / why we need it:
- Adds
#pragma once, like old compiler, now you can use#pragma onceto include the file only once
Which issue(s) this PR fixes:
Fixes #419
What kind of pull this is:
- [ ] A Bug Fix
- [x] A New Feature
- [ ] Some repository meta (documentation, etc)
- [ ] Other
Additional Documentation: Has compatibility for windows paths and directory separator
Seems like AppVeyor build failed for some reason, it works well on my machine (Win10, VS 2017) Also Travis CI build passed, would be glad if someone find me what's wrong.
@Y-Less it only adds _inc_includefilename.extention to table, now that I read wiki, seems like I'm doing it wrong.
For example, you can have two main.inc in different directories and that way the second one just gets ignored.
What's your idea about this one? It can be helpful.
Now what it does is:
with these lines of code:
#include <a_samp>
#include <ColAndreas>
#include <ColAndreas>
#include <float>
#include <ColAndreas>
#include <float>
#include "../../ColAndreas"
that I added #pragma once to colandreas.inc and float.inc, they only get included once.
and these are my debug messages:
Symbol: _inc_float.inc | Added to table
Symbol: _inc_ColAndreas.inc | Added to table
Symbol: _inc_ColAndreas.inc | Already in table
Symbol: _inc_float.inc | Already in table
Symbol: _inc_ColAndreas.inc | Already in table
Symbol: _inc_float.inc | Already in table
Symbol: _inc_../../ColAndreas.inc | Added to table
There's also one more thing to mention, #pragma once does not work when compiler is running with -Z arg; Tell me if I'm doing it wrong.
This issue has been automatically marked as stale because it has not had recent activity.
I think it's better if the include guard symbol does not contain the separators. We need some abstract OS independent symbol name. I think it would be even better to avoid using symbols altogether and use global list of includes.
This issue has been automatically marked as stale because it has not had recent activity.
How did this PR end?
@Y-Less @YashasSamaga
This issue has been automatically marked as stale because it has not had recent activity.