From b21f1c771d0e92f81088c1f675c67de2b58379a3 Mon Sep 17 00:00:00 2001 From: Olive <89336634+OliveIsAWord@users.noreply.github.com> Date: Wed, 27 Jul 2022 14:14:21 -0700 Subject: [PATCH] spelling and grammar keep one spelling error as a treat --- src/conventions.md | 4 ++-- src/formatting.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conventions.md b/src/conventions.md index 2edc404..ed66167 100644 --- a/src/conventions.md +++ b/src/conventions.md @@ -4,7 +4,7 @@ General conventions that C code should obey. ## Memory allocation -Always check the return value of `malloc`. If it is a null pointer, dereference it to immediately abort the processas as we cannot reasonable recover from OOM in most cases. If such a recovery is possible, recover instead. On some platforms, dereferencing a null pointer does _not_ abort the process. In these cases, the null pointer is a perfectly fine pointer, and just continue using it instead. Note that this derefence should usually be a volatile operation as the compiler would optimize it away otherwise. I have reported upstream issues on compilers about this, but they have not yet answered. +Always check the return value of `malloc`. If it is a null pointer, dereference it to immediately abort the processas as we cannot reasonably recover from OOM in most cases. If such a recovery is possible, recover instead. On some platforms, dereferencing a null pointer does _not_ abort the process. In these cases, the null pointer is a perfectly fine pointer, and just continue using it instead. Note that this derefence should usually be a volatile operation as the compiler would optimize it away otherwise. I have reported upstream issues on compilers about this, but they have not yet answered. If the pointer is non-null, `free` it directly after the `malloc` call. This prevents memory leaks of all sorts. Afterwards, you can use it freely in your program. @@ -19,7 +19,7 @@ All identifiers should be given meaningful english names. To work with ancient l ## Comments -Comments are vital to readability. Therefore, code should always be well commented. Comments must be written in the lingua franca of programming, swiss german. +Comments are vital to readability. Therefore, code should always be well commented. Comments must be written in the lingua franca of programming, Swiss German. ```c int main() { diff --git a/src/formatting.md b/src/formatting.md index ab0eeda..a57d3e1 100644 --- a/src/formatting.md +++ b/src/formatting.md @@ -27,7 +27,7 @@ body cannot fit into a single line, make a new function instead. ## Identation -C code must be indented with 3 spaces. The toplevel should be indented as well. +C code must be indented with 3 spaces. The top-level should be indented as well. ```c #include