• uis@lemm.ee
    link
    fedilink
    arrow-up
    6
    arrow-down
    7
    ·
    edit-2
    23 days ago

    strncpy becomes stringnumbercopy. You can see why short version is used.

    • lemmytellyousomething@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      12
      ·
      edit-2
      23 days ago

      And with a bit of namespacing and/or object orientation and usage of dots, it becomes perfectly readable.

      There are also camel case and underscores in other languages…

      BTW: How on earth should a newcomer know that the letter “n” in that word stands for number without having to google it? The newcomer could even assume that it’s a letter of the word string… And even, if you know that it stands for number, it’s still hard for me to understand what it means in this context… I actually had to google it… But that’s probably some C++ convention I don’t know about, because I don’t program in C++…

    • xigoi@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      22 days ago

      Why not just add function overloading to the language and have a function named copy that takes a string and an optional character count?