

Show HN: C Style - my favorite C programming practices - majika
https://github.com/mcinglis/c-style

======
nwmcsween
A few things I disagree with / question:

* The comment includes, this leads to state, you now have to manage what you comment.

* Bool hides the data type.

* ++ vs +=... really?

* VLA usage is debatable.

* There are many more warnings that are useful

~~~
majika
> The comment includes, this leads to state, you now have to manage what you
> comment.

True, but I think it's better to have explicit state that provides information
for the reader. It's also harder to determine if you can remove a header or
not, if it's hard to work out what it gives you.

> Bool hides the data type.

I consider `bool` an abstraction that's useful and standard. You generally
shouldn't need to know the data type under a `bool` anyway.

> ++ vs +=... really?

Yes..? I said this on Reddit: `++` and `+=` both as simple as each other. They
both do the same thing. The differences are:

\- one is useful for other, similar, situations, and the other isn't

\- one is more readable to people with no programming experience, and the
other isn't (if you say C isn't for new programmers - why can't it be?)

\- one has complicated evaluation rules, and a twin brother

\- one encourages state changes in expressions, like `xs[ i++ ]`, and that way
lies madness

That's why I don't like `++` and `--`, but I knew this would be a hard sell
when the language is founded on the examples in K&R :-)

> VLA usage is debatable.

I've heard that. Besides not being able to be initialized, why?

> There are many more warnings that are useful

I started out with every warning I could find for C, but I removed them as I
came across trivial situations that raised warnings - in which case, I didn't
consider them worth it.

What other warnings do you work with?

