This document outlines the coding style guidelines to be followed when contributing to the evo-crypter
project. Consistency in coding style is important for maintainability, readability, and collaboration.
We generally follow the Linux Kernel coding style with a few modifications, enforced using cppcheck and clang-format.
/* ... */
for multi-line comments.//
for single-line comments.@
tags for functions, structs, enums, and typedefs.Example:
int num_threads;
, char *input_file;
void apply_mutation(char *str);
#define BUFFER_SIZE 1024
, const int MAX_THREADS = 16;
typedef struct ChunkProcessingArgs { ... };
input_processing.c
, config_parser.h
EVO_<FOLDER>_<FILE>_H
src/config/cli.h
the header file definition should be EVO_CONFIG_CLI_H
if
, else
, for
, while
, and do-while
statements, even if the body contains only a single statement.x = a + b;
, i < n
int a, b, c;
, printf("%d, %s", num, str);
if
, for
, while
, switch
, return
: if (x > 0) { ... }
, return 0;
result = my_function(arg1, arg2);
(a + b)
, not ( a + b )
"my_header.h"
) over system includes (<my_header.h>
) for project-specific headers.fopen
, malloc
, pthread_create
).const
correctness where applicable.clang-format
to automatically format your code. A .clang-format
file is provided in the project root.cppcheck
to check for common coding errors.//
) for short comments.@
or \
for doxygen commands/** ... */
for doxygen comments@brief
to start a brief description@param
to describe a function parameter@return
to describe the return value of a function@see
to add a cross-reference to a related function, variable, or type@ref
to add a cross-reference to a specific struct, enum or typedef@code
and @endcode
to add a code example@note
to add a note@warning
to add a warning@pre
to describe a precondition@post
to describe a postcondition@invariant
to describe an invariant@throws
to describe an exception@todo
to add a todo item@deprecated
to mark a function or variable as deprecated@since
to indicate the version when a function or variable was added@author
to add the author of a function or variable@date
to add the date when a function or variable was added@version
to add the version of a function or variable@bug
to add a bug description@test
to add a test case@example
to add an example@dir
to document a directory@file
to document a file@namespace
to document a namespace@class
to document a class@struct
to document a structure@enum
to document an enumeration@union
to document a union@var
to document a variable@fn
to document a function@typedef
to document a typedef@defgroup
to define a group of related functions, variables, types, etc.@ingroup
to add a function, variable, type, etc. to a group@{
and @}
to group related functions, variables, types, etc..vscode
folder with recommended settings for VS Code..editorconfig
file to ensure consistent coding style across different editors and IDEs.Note: This coding style guide is a living document and may be updated as the project evolves. When in doubt, follow the style of the surrounding code. If you have any questions or suggestions, please open an issue on the project's GitHub repository.