Skip to content

Commit e475706

Browse files
committed
Rewrote Contributing guidelines
Signed-off-by: Ronald Caesar <github43132@proton.me>
1 parent bd0bf1d commit e475706

File tree

1 file changed

+9
-50
lines changed

1 file changed

+9
-50
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,23 @@
1-
**IMPORTANT: THE MEMORY ALLOCATION AND OOP BAN WILL BE REVERSED ONCE WE START SWITCH EMULATION**
1+
# Core Principles
22

3-
# Data-Oriented Design Fundamentals
4-
5-
This document outlines the core principles and guidelines for contributing to our project, which has been rewritten
6-
using a data-oriented design (DoD) approach.
7-
8-
## Why Data-Oriented Design?
9-
10-
The source code is now written in a data-oriented style instead of an object-oriented one. This change was made because
11-
traditional OOP can be CPU cache-unfriendly, leading to slower performance compared to DoD principles.
12-
13-
While Yuzu's entire codebase is object-oriented, we believe that applying DoD from the very beginning could
14-
significantly improve its speed and efficiency.
15-
16-
## Key Resources
17-
18-
To learn more about data-oriented design fundamentals, please refer to this invaluable resource:
19-
20-
https://github.com/dbartolini/data-oriented-design
21-
22-
This guide should be treated as a fundamental reference when working on our codebase.
23-
24-
## Core Principles
3+
**IMPORTANT: Pound's C++ codebase is written in a C-style, intentionally avoiding C++ features except for namespaces. The goal is to hopefully make the codebase easy to follow, understand, and debug for new developers wanting to contribute.**
254

265
### 1. Performance First
276

287
Performance is the top priority in all aspects of development. Always ask yourself: "Is the CPU wasting cycles running
29-
this code? If so, how do I fix it?" The data-oriented design resource above contains answers to these questions.
8+
this code? If so, how do I fix it?".
309

3110
### 2. Memory Management
3211

33-
- **Heap Allocation Ban**: Using memory allocation functions like malloc(), free(), new, and delete is prohibited.
34-
- **Stack Preference**: Keep everything on the stack whenever possible.
35-
- **Last Resort**: If you must allocate memory, use our custom memory allocator in `core/memory/arena.h`. This should be
36-
your last resort only.
37-
38-
The reason for these strict rules is that heap allocations can introduce undefined behavior issues into our codebase.
12+
- **Heap Allocation Functions Ban**: Using memory allocation functions like malloc(), free(), new, and delete is prohibited. Use our custom memory allocator in `src/host/memory/arena.h`. Allocating memory should only be done in `main.cpp` during initialization, otherwise your code will be rejected.
3913

4014
### 3. Safety First
4115

42-
1. **Error Handling**: Every return code from a function must be checked and handled appropriately.
43-
2. **Assertions**: Use assertions to guarantee behavior whenever possible. Watch this video for an explanation:
16+
1. **Barr C**: See the Barr C Style Guide PDF file in the root directory for making Pound's code as safe as possible.
17+
2. **Error Handling**: Every return code from a function must be checked and handled appropriately.
18+
3. **Assertions**: Use assertions to guarantee behavior whenever possible. Watch this video for an explanation:
4419
https://youtube.com/shorts/M-VU0fLjIUU
45-
3. **Static Analysis**: Use the SonarQube static analyzer to catch potential bugs early in development.
20+
4. **Static Analysis**: Use the SonarQube static analyzer to catch potential bugs early in development.
4621

4722
### 4. Documentation
4823

@@ -51,7 +26,7 @@ by current and future programmers working on this project.
5126

5227
## Style Conventions
5328

54-
Refer to `main.cpp` and the kvm folder for examples of proper code styling. Here are some specific rules:
29+
See the Barr C style guide for reference. Use clang-format at the root directory to create Barr C compliant code. Here are some non Barr C specific rules:
5530

5631
1. **Constant First in Equality Tests**:
5732
```c
@@ -63,19 +38,3 @@ Refer to `main.cpp` and the kvm folder for examples of proper code styling. Here
6338
if (constant == var)
6439
if (NULL == pointer)
6540
```
66-
2. **Todo Comments**: Use the following format:
67-
```c
68-
// Todo(<Username>:<section>): ...
69-
70-
Where <section> is one of:
71-
72-
- cpu
73-
- gpu
74-
- gui
75-
- memory
76-
- filesystem
77-
78-
For example:
79-
// Todo(GloriousTaco:memory): Create a custom allocator.
80-
```
81-

0 commit comments

Comments
 (0)