• HexesofVexes@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    25 days ago

    It works and is a pile of jank - Python

    It doesn’t work and is a pile of jank - C++

    You violated gods laws with how bad your code is and it still runs (right through the wall) - C

  • UnfortunateShort@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    26 days ago

    In bigger projects, you tend to miss type safety really bad, really fast. Rust has it built in, Python can have it bolted on. That’s simply one of the many aspects to consider when choosing your programming language.

    But don’t worry about it too much. If one thing’s for sure, it’s that you will regret that choice in any case.

  • Limonene@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    C when I cast a char * * to a char * * const: ok

    C when I cast a char * * to a char * const *: ok

    C when I cast a char * * to a char const * *: WTF

    C when I cast a char * * to a char const * const *: ok

    • xep@fedia.io
      link
      fedilink
      arrow-up
      0
      ·
      26 days ago

      The WTF case isn’t allowed because it would allow modification of the const. From https://en.cppreference.com/w/cpp/language/implicit_conversion

      int main() { const char c = ‘c’; char* pc; char** ppc = &pc; const char** pcc = ppc; // Error: not the same as cv-unqualified char**, no implicit conversion. *pcc = &c; *pc = ‘C’; // If the erroneous assignment above is allowed, the const object “c” may be modified. }

  • neidu3@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    26 days ago

    Perl when I iterate over an object and treat the result as a hash reference: “fine, whatever. Fuck you, tho”