Skip to content

Commit b6f9640

Browse files
committed
contrib : add TODO for preprocessor directives [no ci]
1 parent 31a4409 commit b6f9640

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

CONTRIBUTING.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@
2323
- Vertical alignment makes things more readable and easier to batch edit
2424
- Clean-up any trailing whitespaces, use 4 spaces for indentation, brackets on the same line, `void * ptr`, `int & a`
2525
- Use sized integer types in the public API
26-
- Declare structs with `struct x {}` instead of `typedef struct x {} x`
26+
- Declare structs with `struct foo {}` instead of `typedef struct foo {} foo`
2727
- In C++ code omit the `struct` keyword whenever it is not necessary
2828
> [!NOTE]
2929
> This guideline is yet to be applied to the `llama.cpp` codebase. New code should follow this guideline.
30+
- Try to follow the existing patterns in the code (indentation, spaces, etc.). In case of doubt use `clang-format` to format the added code
3031
- Tensors store data in row-major order. We refer to dimension 0 as columns, 1 as rows, 2 as matrices
3132
- Matrix multiplication is unconventional: [`C = ggml_mul_mat(ctx, A, B)`](https://github.com/ggerganov/llama.cpp/blob/880e352277fc017df4d5794f0c21c44e1eae2b84/ggml.h#L1058-L1064) means $C^T = A B^T \Leftrightarrow C = B A^T.$
32-
- Try to follow the existing patterns in the code (indentation, spaces, etc.). In case of doubt use `clang-format` to format the added code
3333

3434
![matmul](media/matmul.png)
3535

36+
- Preprocessor directives
37+
- (TODO: add guidelines with examples and apply them to the codebase)
38+
39+
```cpp
40+
#ifdef FOO
41+
#endif // FOO
42+
```
43+
3644
# Naming guidelines
3745

3846
- Use `snake_case` for function, variable and type names

0 commit comments

Comments
 (0)