A single heading that includes other headings

I recently came across this approach to managing headers. I could not find a lot of information about my problems on the Internet, so I decided to ask here.

Imagine that you have a program in which you have main.c, as well as other sources and headers, for example:person.c, person.h, settings.c, settings.h, maindialog.c, maindialog.h, othersource.c, othersource.h

sometimes main settings.cmay be required .person.cmaindialog.c

Sometimes, some other sources may need to include other source files. This is usually done internally settings.c:

//settings.c
#include "person.h"
#include "maindialog.h"

But I came across an approach that global.halso has an inside of it:

//global.h
//all headers we need
#include "person.h"
#include "maindialog.h"
#include "settings.h"
#include "otherdialog.h"

, "global.h" , . global.h ?

+3
2

, . , , global.h, .

#ifndef unique_token
#define unique_token
#pragma once

// the useful payload

#endif
+3

, (, config.h), . ( ...)

, . , , , ...

, . , ( ), fwd include.

0

All Articles