Skip to content

Commit fb669e2

Browse files
committed
minor update
1 parent 620c5b2 commit fb669e2

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

docs/coding_guidelines_cpp.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ int foo(int x);
7171
```
7272
7373
## 7. Using #ifdef
74-
- Write the base function first (no preprocessor).
75-
- Keep normal nested control flow readable before adding feature guards.
76-
- Then add `#if/#elif/#else/#endif` around feature-specific parts.
74+
- Preserve indent of nested code and shift pre-processor left by one level
7775
78-
Base function (no `#ifdef`):
76+
Base function (before):
7977
```cpp
8078
regno_t to_regno_base(const reg_t& reg, bool has_type, bool is_dp) {
8179
if (has_type) {
@@ -88,7 +86,7 @@ regno_t to_regno_base(const reg_t& reg, bool has_type, bool is_dp) {
8886
}
8987
```
9088

91-
Then add feature guards:
89+
Adding ifdef (after):
9290
```cpp
9391
regno_t to_regno_base(const reg_t& reg, bool has_type, bool is_dp) {
9492
if (has_type) {

docs/coding_guidelines_verilog.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ Vortex uses explicit warning management i.e. we directly resolve the warning ins
127127
```
128128

129129
## 7. Using `ifdef
130-
- Write the base logic first (no preprocessor).
131-
- Keep nested control flow readable before adding feature guards.
132-
- Then add one `ifdef/`else/`endif around the feature-specific block.
130+
-Preserve indent of nested code and shift pre-processor left by one level
133131

134132
Base version (before):
135133
```verilog
@@ -149,7 +147,7 @@ Base version (before):
149147
end
150148
```
151149

152-
With feature guards (after):
150+
Adding ifdef (after):
153151
```verilog
154152
always_comb begin
155153
decode_valid = issue_valid;

0 commit comments

Comments
 (0)