• NateNate60@lemmy.world
      link
      fedilink
      arrow-up
      23
      ·
      6 hours ago

      This diagram is nonsense. JavaScript programmers know to simply never use == but to use === instead. Half of JavaScript is like this. Oh, there’s a feature, but it behaves in a super weird way so we don’t use it to avoid the weirdness.

      • dan@upvote.au
        link
        fedilink
        arrow-up
        6
        ·
        5 hours ago

        The recommended ESLint rules catch most of the bad stuff, and these days this is all you need in your ESLint config to enable them:

        import {defineConfig} from 'eslint/config';
        import js from '@eslint/js' 
        
        export default defineConfig([
          js.configs.recommended,
        ]; 
        

        There’s one use case where == is still commonly used: == null matches both null and undefined. Lint rules that block == usually allows the null case as an exception.

        • Venator@lemmy.nz
          link
          fedilink
          arrow-up
          3
          ·
          4 hours ago

          I wonder how much bandwidth is wasted on the extra =, since it survives minification 😅

          • Ignotum@lemmy.world
            link
            fedilink
            arrow-up
            4
            ·
            4 hours ago

            But if every single comparison used in a file is a triple =, then any compression algo worth its weight in salt will compress that bloat away during transmission

            The real issue is all the precious precious RAM those extra = use on the client device once received and unpacked!

          • 9point6@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            4 hours ago

            Gzip (any properly configured static server will serve compressed assets) probably compresses them down so probably a single extra byte per file

      • 9point6@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        5 hours ago

        IIRC modern linter rulesets generally just outright error if you do anything remotely like this.

  • Girl Named ZERO@piefed.zeromedia.vip
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 hours ago

    For those needing help the code is:

    using namespace std;
    int main()
    {
    while (true)
    {
    cout << 'e';
    cerr << 'e';
    }
    return 'e';
    }
    

    Anyway, my opinion: c is the best thing to ever exist, and c++ is evil

  • trxxruraxvr@lemmy.world
    link
    fedilink
    arrow-up
    24
    arrow-down
    1
    ·
    6 hours ago

    No. I don’t find it a particularly nice language to work with, but there’s no reason to fear it. Just make sure you know what you’re doing if/when you use it.