Clarity vs Brevity

This is a discussion on Clarity vs Brevity within the C++ Programming forums, part of the General Programming Boards category; I know it depends on you style of coding, but when you write a program, what's more important to you: ...

Clarity vs Brevity

I know it depends on you style of coding, but when you write a program, what's more important to you: Clarity or brevity. For example, some people find it very rewarding when they get a lot of 'bang' out of a short amount of code, while others prefere to extend this code for easier readability. What's your oppinion/style?

Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

My compiler completely eliminates the swap in the former case, and just passes b,a to printf instead. All you've managed to do in the latter is confuse what is actually going on, so the compiler has to take the conservative approach and do what you asked.

>what's more important to you: Clarity or brevity.
I enjoy one-liners as much as anyone else, but for production code you should err on the side of clarity. The goal isn't to astound people with your brilliance by writing code not even you can understand a day after writing it, but to write code that anyone can follow and easily maintain.

>what's more important to you: Clarity or brevity.
I enjoy one-liners as much as anyone else, but for production code you should err on the side of clarity. The goal isn't to astound people with your brilliance by writing code not even you can understand a day after writing it, but to write code that anyone can follow and easily maintain.

Unless you're worried about job security. Then obfuscation guarantees you're the only one that can work on the code. It rarely works though

Of course this first example is very extreme. Any programmer with a bit of experience in C or C++ would probably look at you as if you're insance if you tell him to use the first variant over the second because of clarity, in this simple form.

aww yee!, really cool guys. Thanks for you input. lol, i know there's sometimes that i wish i could take 50 lines of code and compress it into 5, and say "look how great i am everyone!" hehe. But your right, clarity is much more important in most cases. cheers