News for hackers. Stuff that matters.
Re:Clang Format Tanks Performance by TwoBit on Tuesday November 19, 2019 @11:54PM (#21581196)
That reordering is simply a feature of clang-format. Some coding standards require sorting includes alphabetically, possibly to avoid dupes and to make all include usage identical between source files.
Re:Clang Format Tanks Performance by dleslie on Wednesday November 20, 2019 @12:34AM (#21581342)
In terms of C/C++ headers, that's like requiring all scopes have their expressions alphanumerically sorted.

C/C++ headers are literal code-injection mechanisms; they aren't modifying a runtime environment by importing symbols, they inject code into the compilation unit.

Re:Clang Format Tanks Performance by OskarS on Wednesday November 20, 2019 @04:40AM (#21582430)
> Some coding standards require sorting includes alphabetically

Those are some pretty dumb coding standards if that's true.

(I mean, yeah, the original fault is with the C preprocessor and the fact that header order matters, but since we're stuck with that, having those kinds of coding standards is pretty darn silly!)

Re:Clang Format Tanks Performance by antoinealb on Wednesday November 20, 2019 @08:24AM (#21583658)
Well given that the order of the headers matter, wouldn't it make sense to have the coding standard specify one true include order ? That's the only way to have a deterministic result.
Re:Clang Format Tanks Performance by yifanl on Wednesday November 20, 2019 @08:49AM (#21583828)
That ties namespacing to performance, which just sounds horrible to deal with.
Re:Clang Format Tanks Performance by antoinealb on Wednesday November 20, 2019 @10:58AM (#21584972)
Of course, the bug is horrible. But given that those type of bugs exist, having a fixed ordering of include statements seem like the least painful way to go.
Re:Clang Format Tanks Performance by jlarcombe on Wednesday November 20, 2019 @04:57AM (#21582495)
Indeed, and one reason I dislike sorting header includes alphanumerically is that it makes it easy for include-order-dependencies between them to creep in, as they're always used in the same relative order.