this post was submitted on 03 May 2025
26 points (84.2% liked)

Programmer Humor

22958 readers
989 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Description, because "alt text" can't show it well:

			{
				emit differentFiles (ckFile.absoluteFilePath(),
					otherFile.absoluteFilePath(),
					FileCompareWorker::FileComparisonParams{FileComparisonParams::FileNameMatch,
						(ckFile.size() > otherFile.size()) ? FileComparisonParams::File1IsLarger
							: FileComparisonParams::File2IsLarger});
			}

After Alignment

			{
				emit differentFiles (ckFile.absoluteFilePath(),
					otherFile.absoluteFilePath(),
					FileCompareWorker::FileComparisonParams{FileComparisonParams::FileNameMatch,
						(ckFile.size() > otherFile.size()) ? FileComparisonParams::File1IsLarger
														   : FileComparisonParams::File2IsLarger});
			}
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Lucien@mander.xyz 8 points 17 hours ago (1 children)

Like the other commented said, this isn't random, but also I'd add that your first ternary option, the ?, should be on the next line; it would make the alignment make more sense to you then, and it would make the block more legible.

[โ€“] ulterno@programming.dev 3 points 17 hours ago* (last edited 17 hours ago)

I think I'd rather go with the ? being on the same line as the 'condition' and the rest can go on the other line.

Otherwise, I'd be looking one line downwards and then coming back up after realising that it is a (cond)?ex:ex operator.


And I get that it's not random, just that I asked for it at as many places as possible to not do alignment.
And from what I can recall, I had managed to make stuff work with the older clang-formats...
Or maybe not. Maybe this kind of code never went through it.