Skip to content
DevMeme
3377 of 7435
California Issues a Health Warning for C++ Code
Languages Post #3710, on Sep 17, 2021 in TG

California Issues a Health Warning for C++ Code

Description

A screenshot of a tweet from Bryce Adelstein Lelbach (@blelbach) describes his experience as a C++ developer on a C-centric driver team at NVIDIA HQ. The tweet includes a photo of a sign his team put up, which is taped to a whiteboard or partition. The sign parodies the California Proposition 65 warning label, stating: 'This code contains C++ constructs that are known to the state of California to cause cancer and birth defects or other reproductive harm.' Taped to the bottom of this sign is a small image from 'The Simpsons,' showing a room full of monkeys at typewriters, with the caption, 'And here is the debugging room.' The humor operates on multiple levels for experienced engineers: it plays on the long-standing 'language war' between C purists, who often view C++ as overly complex and dangerous, and C++ advocates. The Prop 65 format cleverly frames this technical debate in the absurd language of public health warnings. The Simpsons sticker adds a final punchline, mocking the debugging process for complex code as chaotic and random

Comments

37
Anonymous ★ Top Pick A C developer looks at a C++ codebase and asks, 'Do you need a license for all this?' The C++ dev replies, 'No, but we have three different package managers and a 45-minute compile time to keep out the faint of heart.'
  1. Anonymous ★ Top Pick

    A C developer looks at a C++ codebase and asks, 'Do you need a license for all this?' The C++ dev replies, 'No, but we have three different package managers and a 45-minute compile time to keep out the faint of heart.'

  2. Anonymous

    They can slap a Prop-65 label on my C++ templates, but the real occupational hazard is second-hand undefined behavior drifting over from the C files - Valgrind refuses to even put on the hard hat

  3. Anonymous

    The real cancer isn't C++ constructs - it's discovering your perfectly valid C++14 template metaprogramming breaks in C++17, then realizing the driver team's plain C code from 2003 still compiles unchanged while you're on your third refactor this quarter

  4. Anonymous

    When your C colleagues welcome you to the team by treating C++ like a hazardous material requiring regulatory warnings, you know you've found your people. The real cancer is trying to explain why `std::enable_if_t<std::is_same_v<T, U>>` is actually 'readable' to someone who's been writing kernel drivers in pure C for 20 years. At least the debugging room has capacity for the inevitable template instantiation error discussions

  5. Anonymous

    C++ finally gets Prop 65: because nothing causes 'reproductive harm' like iterator invalidation mid-loop

  6. Anonymous

    Kernel Prop 65: prolonged exposure to templates, exceptions, and RTTI increases risk of undefined behavior - compile with -fno-exceptions, -fno-rtti, and consider Rust as PPE

  7. Anonymous

    The C driver team slapped a Prop 65 on my C++ - fair enough: in kernel land, exceptions are contraband, RTTI is a controlled substance, and every template instantiation warms the datacenter

  8. @tarasssssssssssssss 4y

    Sorry, what is HQ?

    1. @domokrch 4y

      headquarters

  9. @Agent1378 4y

    As if pure C is any better

    1. @zunkree 4y

      Much better

    2. @sashakity 4y

      pure c is godly

    3. @CcxCZ 4y

      C is not great. C++ doesn't remove any of the issues of C and adds two languages worth more. It doesn't matter. In it's class there is rarely option of choice. In cases where you reach for these you usually are integrating something closely with the OS and/or hardware. All unices have their official interface defined as C library (libc). With notable exception of Linux they rarely document their ABI so language designers would have to reverse-engineer them if they wanted to call syscalls without going through C FFI. Windows is C++ through and through. Bare metal has more options, you may get away with using Ada or Rust if you have some common ARM μC, otherwise good luck getting compiler support for your target. Like with Browser API being locked behind JavaScript even if you run WASM, if you need to deal with C or C++ libraries and calling conventions you can't really escape lot of the misdesigns and might as well bite the bullet. Or use some safety wrapper like Drunk Octopus, ATS2 or Low*/kreMLin that generates low level C after some verification of code correctness.

      1. @Rengenius 4y

        👍

      2. dev_meme 4y

        Lol, ofc no Here, make next API of your great startup with C++! https://www.webtoolkit.eu/wt

        1. dev_meme 4y

          There actually enough reasons to use C++ for backend, but development time... Uh, this will not be quick, that's for sure

          1. @sylfn 4y

            C++/Qt

          2. @sylfn 4y

            you forgot debug time

            1. dev_meme 4y

              I merged them under dev time name

          3. @CcxCZ 4y

            Honestly Qt might be considered an OS for the purpose of this discussion. With it's extra preprocessors and whatnot it's been rather painful to generate correct bindings from what I understood.

      3. Deleted Account 4y

        so, how do you call libc without using c?

        1. @sylfn 4y

          asm

          1. Deleted Account 4y

            nono, " All unices have their official interface defined as C library (libc)." how do you call libc without using c

            1. Deleted Account 4y

              or c ffi

            2. @sylfn 4y

              libc w/o c is just lib

        2. @CcxCZ 4y

          Via FFI (foreign function interface) which forces you to deal with c library loading and calling conventions. You also need to support data types involved, such as C-style strings, particular layout of structs including alignment… There's a lot.

          1. Deleted Account 4y

            soo, you do that on all unices

            1. Deleted Account 4y

              except linux

              1. Deleted Account 4y

                doesn't linux have libc too?

              2. @CcxCZ 4y

                Linux is the only one where you might be able to write replacement for libc for your language because it's actually documented how. Few bother because it's a huge task. I think Go might have had few raw syscall interfaces, but will often also require libc. (Haven't checked in a while, that's been surely area of work)

                1. Deleted Account 4y

                  well, i see what you mean here now, i did not understand you correctly there

          2. Deleted Account 4y

            also, you may leave out the enumeration of c specific things, i know them too

            1. @CcxCZ 4y

              Enums are source-only construct that translate to integers. But unions and basically all memory layout stuff is a concern.

              1. Deleted Account 4y

                whatt?? i wasn't meaning that at all, what i meant is that i know about all the c and hardware specific things, so you may not bother telling me about them all over again

          3. Deleted Account 4y

            and how does libc help in not using c?

            1. Deleted Account 4y

              and how come linux isn't documenting its syscalls

  10. @beton_kruglosu_totchno 4y

    cringe

Use J and K for navigation