711
you are viewing a single comment's thread
view the rest of the comments
[-] urfavlaura@lemmy.ml 12 points 1 month ago
[-] LemoineFairclough@sh.itjust.works 3 points 1 month ago* (last edited 1 month ago)

*(char*)0 = 0; - What Does the C++ Programmer Intend With This Code? - JF Bastien - C++ on Sea 2023

https://www.youtube.com/watch?v=dFIqNZ8VbRY

[-] milicent_bystandr@lemm.ee 2 points 1 month ago

How would you use that for debugging?

(Sry I'm too cheap to go and buy the book)

[-] jxk@sh.itjust.works 6 points 1 month ago

My best guess is that in some configurations it raises SIGSEGV and then dumps core. Then, you use a debugger to analyse the core dump. But then again you could also set a breakpoint, or if you absolutely want a core dump, use abort() and configure SIGABRT to produce a core dump.

[-] urfavlaura@lemmy.ml 2 points 1 month ago

to see whether your code has executed a certain path (like printf("here") but as a crash)

this post was submitted on 20 Aug 2024
711 points (98.8% liked)

Programmer Humor

32197 readers
407 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS