Sujet : Re: question about linker
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.cDate : 12. Dec 2024, 11:08:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjecm6$22uqf$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 11/12/2024 23:03, Michael S wrote:
On Wed, 11 Dec 2024 21:19:54 +0000
bart <bc@freeuk.com> wrote:
>
This also comes up with 'while (cond); {...}'.
>
$ cat foo.c
void foo(int x)
{
while (x--);
bar();
}
$ clang-format < foo.c
void foo(int x) {
while (x--)
;
bar();
}
Do I use clamg-format myself? No, I don't.
And I don't know why C formatters are generally less popular among C
programmers then, for example, go formater among Go programmers or Rust
formatter among Rust programmers.
I suspect that there is a great deal more variation in common styles and formatting amongst C programmers than amongst Go or Rust programmers. Part of that is the way people learned the language in the early days.
When C was new, there were lots of variants of the language, and lots of people using it quite independently. They learned from colleagues, magazine articles, books, etc. Tools were limited, and you often had a choice of writing clear code, or writing something that the tool would turn into efficient object code - not both.
With modern languages like Go and Rust, the internet was well established. People learned from common sources - the Rust website, for example. And tools were good from a much earlier stage, so you could get the habit of writing clear code rather than learning "tricks" to generate efficient results from poor tools.
So I think C programmers often got set in their ways from much earlier, while users of modern languages were more influenced by common sources. With less variation in the way code is written, it's a lot easier to agree on how code /should/ be written.
In the C world, if you ask five programmers how the "foo" function should be laid out, you'll get ten different answers - people are naturally less keen on a formatting tool that generates formats you disagree with!