Skip to content

Commit

Permalink
Update config.h boilerplate to use #pragma once
Browse files Browse the repository at this point in the history
According to @fredizzimo, this is a safer and easier way to handle the
boilerplate.
  • Loading branch information
evantravers authored and jackhumbert committed Jul 15, 2018
1 parent 3d7bfae commit c5c112a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions docs/getting_started_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,20 @@ There are 3 possible `config.h` locations:
* userspace (`/users/<user>/config.h`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`)

The build system automatically picks up the config files in the above order. If you wish to override any setting set by a previous `config.h` you will need to first include some boilerplate code around the settings you wish to change.
The build system automatically picks up the config files in the above order. If you wish to override any setting set by a previous `config.h` you will need to first include some boilerplate code for the settings you wish to change.

```
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
// overrides go here!
#endif
#pragma once
```

Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again.

The boilerplate code and setting look like this together:

```
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#pragma once
// overrides go here!
#undef MY_SETTING
#define MY_SETTING 4
#endif
```

0 comments on commit c5c112a

Please sign in to comment.