Skip to content

Remove usage of truncated includes #1565

@r-burns

Description

@r-burns

We have a lot of usage of "truncated" include paths in our melee code, such as the following:

#include "ft/forward.h"
#include "ft/ftparts.h"
#include "ft/fighter.h"
#include "ft/inlines.h"
#include "ft/types.h"
#include "lb/lbrefract.h"

Because of this, we are including files relative to src/ as well as src/melee/, so both have to be added to the include path.

To be consistent with C coding standards, we should limit the number of include paths that need to be added to the compile-line - so just src/ for melee code. We should only use quote-includes for paths relative to the current file, and use bracket-includes for fully-qualified includes relative to include paths.

I would propose that the above snippet could look like this:

 #include "forward.h" 
  
 #include "ftparts.h" 
  
 #include "fighter.h" 
 #include "inlines.h" 
 #include "types.h" 
 #include <melee/lb/lbrefract.h> 

The choice to use quote-includes for files in the same directory is a matter of taste. One could also fully-qualify all includes, like this:

 #include <melee/ft/forward.h>
  
 #include <melee/ft/ftparts.h>
  
 #include <melee/ft/fighter.h>
 #include <melee/ft/inlines.h>
 #include <melee/ft/types.h>
 #include <melee/lb/lbrefract.h> 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions