blueoil icon indicating copy to clipboard operation
blueoil copied to clipboard

Rule for C++ code of converter is little messy

Open tk26eng opened this issue 4 years ago • 2 comments

The files under blueoil/converter/templates has different styles. It's better to be ruled to make reading the code easier.

Now following point I found is not ruled.

  • Various style of include guard There're several style in .h files.
  1. pragma once style
# pragma once
  1. traditional style
#ifndef SOMETHING_UNIQUE
#define SOMETHING_UNIQUE
#endif

A naming rule for SOMETHING_UNIQUE is also not ruled.

  • Some .h includes definition Some .h files include definition (implementation). Definitions should be separated to .cpp file. Otherwise the function defined in .h files can't be called from 2 or more places and a compilation error will happen.

  • Deferent number of spaces between .h and .cpp .cpp files have two spaces as an indent. .h files have four spaces as an indent. Code of .cpp have deep nest (indent) because of looping multi dimensional array, it might be acceptable.

What do you think about this ? Should it be improved ?

tk26eng avatar Mar 23 '20 10:03 tk26eng

Yes, It's should be improved. Should we decide the coding rule of C++?

iizukak avatar Mar 24 '20 00:03 iizukak

pragma once style is not C++ standard, but accepted by gcc and clang.

primenumber avatar Mar 24 '20 04:03 primenumber