Skip to content

Header File Issues #15

Open
Open

Description

@jehicken

Remove redundant header includes from .cpp files.

Also, header files should be included as follows:

  1. System (C++ libraries) level headers
  2. Other dependencies (e.g. mfem, Adept,...)
  3. Our own (mach) headers

There should be a space between each of these groups. Here is an example:

#ifndef MACH_SOLVER
#define MACH_SOLVER

#include <fstream>
#include <iostream>

#include "mfem.hpp"
#include "adept.h"
#ifdef MFEM_USE_SIMMETRIX
#include <SimUtil.h>
#include <gmi_sim.h>
#endif
#ifdef MFEM_USE_PUMI
#include <apfMDS.h>
#include <gmi_null.h>
#include <PCU.h>
#include <apfConvert.h>
#include <gmi_mesh.h>
#include <crv.h>
#endif

#include "mach_types.hpp"
#include "utils.hpp"
#include "json.hpp"

Activity

  1. changed the title [-]How should header files be included?[/-] [+]Header File Issues[/+] on Jan 29, 2020
  2. tuckerbabcock commented on Jan 31, 2020

    @tuckerbabcock
    Member

    Also, header files should only include other header files if absolutely necessary, we should prefer to have the .cpp files do the including they need for implementation, and use forward declarations in headers where possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions