Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Regularized #include under include/mruby/*.h #3032
According to C Preprocessor syntax (see the manual), the
The original call, e.g.
Conversely, the current PR is always working (i.e. regardless compilation switches), because
This was referenced
Nov 27, 2015
@matz bear with me and please forgive me for insisting, but your answer looks contrary to the intended usage for #include as explained by the GCC preprocessor manual.
Including the file in the very local directory is what you want. Conversely, using angle brackets means "go search for
IMHO, using angle brackets rather than using double quotes with local path has a possible issue when the user has another version of mruby installed in the system path, because in this case the headers under
I still think that using e.g.
added a commit
this pull request
Nov 27, 2015
@matz: Let's make this example. Suppose that the file
#include "common.h" #include "compile.h"
at lines 10 and 11. When he needs to include
Conversely, with the current code at lines 10 and 11 of
#include <mruby/common.h> #include <mruby/compile.h>
it still works, but there is the risk that, if the user has something like
Again, using the local include is not changing the API in any way, it is just making the code stronger w.r.t. different possible build conditions.
For internal headers, e.g.
If you have a real error case (not theoretical one), I'd happy to be corrected.
@matz I have made a real case here: https://gist.github.com/pbosetti/152379270f53d2386643
The example script shows how using local include commands in mruby headers (when they refer each other and by using relative paths to the current file) the user only has to add the main header folder to the headers path (with
Conversely, with the current code in HEAD, this solution would not work and the user has to needlessly add another
I am aware that there are other ways for solving the same problem, but using local includes in mruby headers has the following advantages: