3 ms·
Terrible The first rule of C is to ALWAYS use C The second rule of C is to NEVER use [u]intN_t, use [u]int_leastN_t instead and (unsigned) char when you want
by annathebannana 11y ago
Terrible
The first rule of C is to ALWAYS use C
The second rule of C is to NEVER use [u]intN_t, use [u]int_leastN_t instead and (unsigned) char when you want to deal with bytes
The 3rd rule of C is to never use anything else when size_t should be used
The 4th rule of C is that everyone has his own style, so declaring variables on top is totally acceptable (and more clean IMO)
The 5th rule of C is "enjoy your stack overflow" when using VLAs instead of malloc (not to mention that VLAs are optional in C11)
>which also means it's capable of holding the largest memory offset in your program.
wrong
>C99 gives us the power of <stdbool.h> which defines true to 1 and false to 0
I do use it but it is useless
>readability-braces-around-statements — force all if/while/for statement bodies to be enclosed in braces
don't use a shitty editor
>You should always use calloc
good thing calloc has: checks for overflows when multiplying the typesize and the arraylen
bad thing: makes programmers think that it will make your pointers null
>you can wrap it with #define mycalloc(N) calloc(1, N).
but the two arguments is the only good thing calloc has
>growthOptional
I can't see any reason why the second one is considered better
- jimjag 11y ago++1