diff options
author | dundargoc <gocdundar@gmail.com> | 2023-11-10 12:23:42 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-12 22:01:28 +0100 |
commit | 4f8941c1a5f1ef6caa410feeb52e343db22763ce (patch) | |
tree | 6e801079d088533198d526cb9aac8eb7981dc568 /runtime | |
parent | 353a4be7e84fdc101318215bdcc8a7e780d737fe (diff) | |
download | rneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.tar.gz rneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.tar.bz2 rneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.zip |
refactor: replace manual header guards with #pragma once
It is less error-prone than manually defining header guards. Pretty much
all compilers support it even if it's not part of the C standard.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/dev_style.txt | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index d6c465ef91..cb28f1a845 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -32,19 +32,13 @@ but we nonetheless keep things as they are in order to preserve consistency. Header Files *dev-style-header* -The #define Guard ~ +Header guard ~ -All header files should have `#define` guards to prevent multiple inclusion. -The format of the symbol name should be `NVIM_<DIRECTORY>_<FILE>_H`. +All header files should start with `#pragma once` to prevent multiple inclusion. In foo/bar.h: >c - #ifndef NVIM_FOO_BAR_H - #define NVIM_FOO_BAR_H - - ... - - #endif // NVIM_FOO_BAR_H + #pragma once < @@ -245,15 +239,13 @@ contain only non-static function declarations. >c // src/nvim/foo.h file - #ifndef NVIM_FOO_H - #define NVIM_FOO_H + #pragma once … #ifdef INCLUDE_GENERATED_DECLARATIONS # include "foo.h.generated.h" #endif - #endif // NVIM_FOO_H 64-bit Portability ~ |