Skip navigation
Printf in C is so BAD I had a Crash Out
0:00 / 3:29

Printf in C is so BAD I had a Crash Out

Тsфdiиg

@tsoding121K followers

Visit on X
1,614 likesDownloadOriginal post

59,036 views

Printf in C is so BAD I had a Crash Out

33 Comments

Comments from the original post on X (Twitter)

  • Cool beans's profile picture

    @maxxkph

    careful, crashing out in C is undefined behavior

    25 likes

  • Тsфdiиg's profile picture

    @tsoding

    Follow me on Twitch for more crash outs

    17 likes

  • BetaAlpha's profile picture

    @kabutuo59766

    Who is he, I want to follow him

    10 likes

  • BetaAlpha's profile picture

    @kabutuo59766

    Lol. I will watch you twitch when I have time

    2 likes

  • william's profile picture

    @w______roy

    I never understood why it doesn’t give you the number of args when that is always known at compile time.

    9 likes

  • borrowck-novel's profile picture

    @borrowck_novel

    Although the bar is extremely low, it didn't stop Jai to make it's print system even worse.

    9 likes

  • purnyameow's profile picture

    @PurnyaMeow

    I wasn't aware of the horrors printf could hide, holy shit

    6 likes

  • Bruce's profile picture

    @StirringDragon

    C was not designed with security in mind, it was designed with low level control in mind, as was any language that gave you access to pointers. That said, printf still rules from an ease of use perspective. C++'s cout was a sick joke on programmers.

    3 likes

  • Mikhail's profile picture

    @mikpom_

    As someone far from CS this how I demarcate high- low-level programming languages: by how easy is it to print shit.

    2 likes

  • CaptainAmericaTex's profile picture

    @CaptAmericaTx

    There is a way to sort of find the end of the variadic list. In main, register a signal handler for segmentation fault, and in the signal handler do a longjmp() to the instruction following the variadic for loop. Not 100% reliable, but if it is 2am and project is due at 8am... 🙃

    2 likes

  • Zorkimer's profile picture

    @Zorkimer

    I just replaced it. Literals just memcpy'd, no string parsing at all, no UB from accidentally %ing the wrong type, no different identifiers on windows and linux. Just make your own thing and call the OS's write().

    2 likes

  • Οεσε Παπα's profile picture

    @papavo

    It's C, you can roll your own printf.

    2 likes

  • Lancelot's profile picture

    @GodLancelot91

    Honestly, all the replacements are terrible like std::fmt/fmtlib, etc. All parse string formatter metadata at runtime and because of that are WAY too heavy for some important enviroments.

    1 like

  • WERYFRT 🇮🇹's profile picture

    @weryfrate

    @grok Why did he crash out?

    1 like

  • tosho's profile picture

    @tosho

    dude, wtf is this thumbnail?! It's genius :D

    1 like

  • Giacomo Masseroni's profile picture

    @giacomomasseron

    which one crashed you out, the format specifiers or the varargs not checking anything

    1 like

  • 7alken's profile picture

    @7alken2

    ))

  • meatball's profile picture

    @24meebo

    amazing how much a simple tagged union type solves

  • facts matter, lies shatter 🇳🇱 🇺🇸's profile picture

    @fctsMttrLsShttr

    Still more fun to work with than shifting formatting attributes to cout. This week I had an issue with printf. Turns out %llu did not work by default in my embedded compiler. I even used PRIu64. No compiler warning or error. It just printed "lu" at runtime instead of a number.

  • BitcoinIsMySafeWord's profile picture

    @bitcoinOrBTC

    You had a crush