home.social

#clang — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #clang, aggregated by home.social.

fetched live
  1. Виды связываний (external, internal, no linkage) для самых маленьких

    Если вы когда-нибудь собирали проекты на C++, то практически наверняка получали ошибку от линковщика формата: /usr/bin/ld: /tmp/ccYa2eaO.o: в функции «foo()»: foo.cpp:(.text+0x0): повторное определение «foo()»; /tmp/ccKEs5I7.o:main.cpp:(.text+0x0): здесь первое определение collect2: error: ld returned 1 exit status Опытным C++ разработчикам эта проблема известна как ODR (One Definition Rule). Но корень этой ошибки выходит далеко за рамки «используй inline в .hpp » и «не определяй ничего в .hpp ». В этой небольшой статье мы попробуем разобраться, как наши объектные файлы, которые мы создаем, видит линковщик и другие единицы трансляции, и при чём здесь таблица символов.

    habr.com/ru/articles/1063468/

    #C++ #clang++ #g++ #ld #cpp

  2. I'm very confused because I was seeing a memory leak on #libcurl on #macos :mac: but not on #linux :linux:
    I reduced the repro to a very simple app, and turns out the problem was that the *Address Sanitizer itself* leaks memory in the mac version???

    Happens with both #Clang and #GCC, so maybe this is actually a #LibreSSL problem that #OpenSSL doesn't have?

    Anyway, it's way past my bedtime, so I'm just leaving this mini-rant here in case anyone that knows about this sees it. 🤞😴

  3. Things I've learned today:
    - Valgrind does not support AVX512 instructions. That was an adventure because I was writing purposefully bad code at the time...
    - However, changed strategies and used `clang` with the `fsanitize=address,undefined` option which seems to work perfectly fine.

    #clang #programming #troubleshooting

  4. Things I've learned today:
    - Valgrind does not support AVX512 instructions. That was an adventure because I was writing purposefully bad code at the time...
    - However, changed strategies and used `clang` with the `fsanitize=address,undefined` option which seems to work perfectly fine.

    #clang #programming #troubleshooting

  5. Парсер C++ на своем DSL: попытка обогнать компилятор

    Проекты растут. Кодовая база растёт. Время компиляции растёт вместе с ними и переходит все границы разумного. В какой-то момент я решил: а что если попробовать написать свой компилятор? Пока только для разработки, не для прода . На замену Clang++/G++/CL.EXE. Эта статья — о первом шаге на этом пути. О парсере C++, который я написал на своём DSL специально сделанном для этого изначально. Матчинг запущен? Кооперация предложена?

    habr.com/ru/articles/1058150/

    #С++ #компиляторы #Парсеры #генераторы_парсеров #разработка #алгоритмы #open_source #C #g++ #clang

  6. Introducing fmetrics: Fast Image & Video Fidelity Metrics in C, Zig

    halide.cx/blog/fmetrics/

  7. 🚀 Android NDK r30 Beta 2 is here!

    Highlights:
    ✅ LLVM updated to clang-r574158b
    🐛 Compiler & LTO fixes
    🔍 Better LLDB debugging
    ⚡ Improved ARM dot product code generation

    Details: github.com/android/ndk/release

    #Android #AndroidDev #NDK #LLVM #Clang #CPP

  8. Why it required a compiler-specific language extension (although thankfully all the compilers that matter, ie and , have converged on the same extension) is beyond me. Being able to detect an overflow is such an obviously useful thing to do that it was implemented in the very first microprocessor, the . I used it heavily in code on the in the 1980s. A mechanism for making use of that flag should have been in the C standard for *decades* by this point. 4/4

  9. Why it required a compiler-specific language extension (although thankfully all the compilers that matter, ie #gcc and #clang, have converged on the same extension) is beyond me. Being able to detect an overflow is such an obviously useful thing to do that it was implemented in the very first microprocessor, the #Intel4004. I used it heavily in #assembler code on the #Z80 in the 1980s. A mechanism for making use of that flag should have been in the C standard for *decades* by this point. 4/4

  10. I just found an error in my printed edition of "Pointers on C":

    The Programs 5.1 (page 96) & 5.2 (page 100) use a left shift, when it should be a right shift.

    (And this error has been corrected in the PDF version that I have)

    However, I really like the book overall! It was a great recommendation, and I enjoy reading it so far! 🙂

    @xexyl @sirwumpus

    #c #cProgramming #clang #pointersOnC

  11. I just found an error in my printed edition of "Pointers on C":

    The Programs 5.1 (page 96) & 5.2 (page 100) use a left shift, when it should be a right shift.

    (And this error has been corrected in the PDF version that I have)

    However, I really like the book overall! It was a great recommendation, and I enjoy reading it so far! 🙂

    @xexyl @sirwumpus

    #c #cProgramming #clang #pointersOnC

  12. Quick and dirty VSCode project for WSL/Ubuntu for getting started with coding in #C for #C64 :
    codeberg.org/csepp/llvm-mos-sa

    Made for my partner and generally for people who might be new to C and for some reason want to learn it while they also learn Commodore 64 programming. She hasn't tried it yet, so I can't vouch for the followability of the docs.

    Uses #LLVMMOS / #Clang / #clangd to make things a bit more ergonomic. I know about CC65 and its debug info and VICE support was tempting, but better code navigation and static analysis IMHO wins.

    PRs that set up support for other IDEs are welcome, as long as they don't break VSCode.

    cc: #theWorkshop

  13. Quick and dirty VSCode project for WSL/Ubuntu for getting started with coding in #C for #C64 :
    codeberg.org/csepp/llvm-mos-sa

    Made for my partner and generally for people who might be new to C and for some reason want to learn it while they also learn Commodore 64 programming. She hasn't tried it yet, so I can't vouch for the followability of the docs.

    Uses #LLVMMOS / #Clang / #clangd to make things a bit more ergonomic. I know about CC65 and its debug info and VICE support was tempting, but better code navigation and static analysis IMHO wins.

    PRs that set up support for other IDEs are welcome, as long as they don't break VSCode.

    cc: #theWorkshop

  14. [$] Hardening the kernel with allocation tokens and bootpatch-SLR

    There is a lot of work going into eliminating exploitable bugs from the kernel and preventing the addition of new ones. Even if this work is maximally successful, though, there is [...]

    lwn.net/Articles/1078699/ #LWN #Linux #kernel #GCC #LLVM #Clang #Git

  15. [$] Hardening the kernel with allocation tokens and bootpatch-SLR

    There is a lot of work going into eliminating exploitable bugs from the kernel and preventing the addition of new ones. Even if this work is maximally successful, though, there is [...]

    lwn.net/Articles/1078699/ #LWN #Linux #kernel #GCC #LLVM #Clang #Git

  16. [$] A helper library for BPF arenas

    BPF arenas are areas of memory (potentially shared with user space) where programs have free reign to build their own data structures, unburdened by the verifier's bounds checks. M [...]

    lwn.net/Articles/1078526/ #LWN #Linux #kernel #GCC #Clang #Git #BPF #LSFMMBPF

  17. [$] A helper library for BPF arenas

    BPF arenas are areas of memory (potentially shared with user space) where programs have free reign to build their own data structures, unburdened by the verifier's bounds checks. M [...]

    lwn.net/Articles/1078526/ #LWN #Linux #kernel #GCC #Clang #Git #BPF #LSFMMBPF

  18. It is not difficult to reproduce most of the functionality in FAISS with hand rolled <2k LOC #OpenMP device code, with equivalent performance if one were to use a reasonably modern #clang compiler (I have blacklisted #gcc for offloading). Benefit: one does not need a full conda environment

  19. Using #sdl2 I finally got my sound working for my PAC-MAN clone in #clang Most of my audio code is pretty much lifted and shifted from LazyFoo (see the link below), I got some .wav files from Sprite Resources and I got them coded up into my game project. I think I have almost all the bones on the skeleton of the project. I just need to get the scoring, and the scene transitions and I'll be all good. As always my code is in my Git repository.

    [lazyfoo.net/tutorials/SDL/21_s]

  20. [$] The first half of the 7.2 merge window

    The 7.2 merge window started with the 7.1 kernel release on June 14. As of this writing, just over 7,000 non-merge changesets have been pulled into the mainline for the next kerne [...]

    lwn.net/Articles/1078068/ #LWN #Linux #kernel #LLVM #Clang #Rust #Git #XFS #BPF

  21. [$] The first half of the 7.2 merge window

    The 7.2 merge window started with the 7.1 kernel release on June 14. As of this writing, just over 7,000 non-merge changesets have been pulled into the mainline for the next kerne [...]

    lwn.net/Articles/1078068/ #LWN #Linux #kernel #LLVM #Clang #Rust #Git #XFS #BPF

  22. [Перевод] Модули C++20 — как я с ними намучился

    В стандарте C++20 было представлено множество нововведений, и одним из наиболее крупных и долгожданных в их числе являлись модули. Теперь, когда с тех пор минуло около шести лет, то воодушевление сменилось здоровым цинизмом. Так, авторы сайта Are We Modules Yet прогнозируют, что поддержка модулей во всех библиотеках будет обеспечена к 1 мая 2167 года, а на Reddit не проходит и двух недель, как возникает очередной тред на тему: «Ну что, ими уже можно пользоваться»? (спойлер: нет). Моя собственная одиссея по работе с модулями началась с того, как я в очередной раз взялся переписывать мою воксельную игру . Насколько же слабо я представлял, во что ввязываюсь.

    habr.com/ru/articles/1045676/

    #модули #C++20 #Clang #библиотеки #зависимости

  23. #linux #gcc #clang #c #cpp #poll 1) do you have a program called "a.out" in your home folder, and if so 2) do you remember what it was