aboutsummaryrefslogtreecommitdiff
path: root/docs/CODE_STYLE.md
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-05-14 00:05:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-15 08:54:42 +0200
commit8df455479f8801bbebad8839fc96abbffa711603 (patch)
treead0fcac278779ef75726f8aec6a061453c043282 /docs/CODE_STYLE.md
parent5d54b5e6971cf26b35d11980d6953bf436419752 (diff)
source cleanup: remove all custom typedef structs
- Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
Diffstat (limited to 'docs/CODE_STYLE.md')
-rw-r--r--docs/CODE_STYLE.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/CODE_STYLE.md b/docs/CODE_STYLE.md
index 0ceb5b9ad..561343752 100644
--- a/docs/CODE_STYLE.md
+++ b/docs/CODE_STYLE.md
@@ -244,3 +244,22 @@ depending on a build-time conditional:
#endif
int content = magic(3);
+
+## No typedefed structs
+
+Use structs by all means, but do not typedef them. Use the `struct name` way
+of identifying them:
+
+ struct something {
+ void *valid;
+ size_t way_to_write;
+ };
+ struct something instance;
+
+**Not okay**:
+
+ typedef struct {
+ void *wrong;
+ size_t way_to_write;
+ } something;
+ something instance;