cross-posted from: https://lemm.ee/post/4890334

cross-posted from: https://lemm.ee/post/4890282

let's say I have this code

` #include #include char name[50]; int main(){ fgets(name,50,stdin); name[strcspn(name, "\n")] = '\0'; printf("hi %s", name); }

` and I decide my name is "ewroiugheqripougheqpiurghperiugheqrpiughqerpuigheqrpiugherpiugheqrpiughqerpioghqe4r", my program will throw some unexpected behavior. How would I mitigate this?

  • DirigibleProtein@aussie.zone
    ·
    11 months ago

    Can’t help with your code, but you should be aware of:

    • https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
    • https://jalopnik.com/this-hawaiian-womans-name-is-too-long-for-a-drivers-l-1313683178
    • hairyballs@programming.dev
      ·
      edit-2
      11 months ago

      The first article is funny, because I moved from my native country to the one right next to it, and everybody is confused by my name. They have one given name and 2 family names, while I have 4 first names, and a compound last name.

      No need to travel to the other side of the planet to meet a different culture of naming.