CLion comes with its own code formatter: Should you use that or clang-format? And if you chose clang-format, how do you set that up? Watch this short video to find out more. #CLion #Cpp #SoftwareDevelopment #ClangFormat #Programming #CPlusPlus

CLion comes with its own code formatter: Should you use that or clang-format? And if you chose clang-format, how do you set that up? Watch this short video to find out more. #CLion #Cpp #SoftwareDevelopment #ClangFormat #Programming #CPlusPlus

Oh, joy, clang-format 22 has compounded an existing bug where AllowShortBlocksOnASingleLine: Empty didn't work by applying the AllowShortBlocksOnASingleLine setting to functions, meaning that there is no way for us to move to clang 22 without some formatting churn.

clang-format version: 16.0.0 on Windows 10 AllowShortBlocksOnASingleLine: Empty behaves like AllowShortBlocksOnASingleLine: Never for empty blocks. Minimal Example: Config: --- BasedOnStyle: Chromi...
I enforce formatting consistency on a C++ code base by running clang-format in CI and failing if it modifies files
clang-format makes breaking changes all the time, so I have set up the build to always use the same version of clang-format everywhere: it downloads clang-format 18.1.8 from PyPI and uses that
..I just encountered a situation where clang-format 18.1.8 running locally on my Mac disagrees with clang-format 18.1.8 running in CI T_T
Реализация утилиты cat на языке C
Когда я только начинала изучать язык C, меня довольно сильно пугала его "топорность" по сравнению с другими языками. Все довольно строгое, управляемое вручную, но именно этим он и привлек меня. Потому что ощущение, будто ты напрямую разговариваешь с системой. В какой-то момент в моем поле появилась задачка: написать две утилиты линуксоидного существа cat и grep. Несмотря на то, что они кажутся довольно простыми, они оказались отличной возможностью погрузиться в работу с файлами, и понять, даже поверхностно, как работает язык C и с чем его едят. В статье постараюсь рассказать и показать ход своих мыслей и почему теперь я смотрю на консольные команды совсем иначе. В этой статье я подробно остановлюсь только на реализации утилиты cat. Что за зверь этот Cat Cat показалась мне более простой в написании, чем grep, да и частично grep строится на базе cat – тоже читает данные из файла, тоже работает со строками, но с небольшим нюансом в виде фильтрации. Что нам важно понимать на старте?
https://habr.com/ru/articles/939382/
#cat #утилита #clang #clangformat #linux #linuxутилита #утилиты
Oh yay #clangformat updated and is now even worse
(No this can't be fixed, give me a .clang-format file which fixes this particular case and I guarantee it'll break 10 other cases)
It's actually wild that regardless of how much time and effort you spend trying to prevent clang-format from aligning stuff, you'll still stumble upon cases which it absolutely insists on aligning. You'd think writing a non-aligning formatter was easier than writing an aligning one?
Worse: it occasionally aligns with tabs if you use tabs, even when you tell it to align with spaces
Автоматическое Выравнивание Отступов в Исходниках (clang-format + Make)
Есть такая тема, как автоматическое выравнивание отступов в исходных текстах программ на Си или С++. Притом для этого есть специальные утилиты. Например clang-format или GNU indent . В этот тексте я написал как встроить процесс выравнивания исходных кодов прямо в систему сборки проекта. Просто в одно касание и выровнять, и собрать бинари.
https://habr.com/ru/articles/833500/
#clang #clangformat #make #makefile #sed #grep #bash #indent #devops #gnu