← Commit list

28471c849c

Daniel Stenberg
Daniel Stenberg
2026-08-27
SUCCESS Duration: 397s

Subject

CODE_STYLE.md: describe how we write typecasts

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

docs/internals/CODE_STYLE.md+11 -0
@@ -208,6 +208,17 @@ complement = ~bits;
empty = (!*string) ? TRUE : FALSE;
```
+## No space following typecasts
+
+As far as possible, we write code to avoid typecasts. When we do use them, We
+write typecasts "glued" to the following expression, with no space after the
+closing parenthesis:
+
+```c
+int value = (int)foobar;
+char *ptr = (char *)random_func();
+```
+
## No parentheses for return values
We use the 'return' statement without extra parentheses around the value: