Rust-Based, Memory-Safe PNG Decoders "Vastly Outperform" C-Based PNG Libraries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • lowflyer
    Senior Member
    • Aug 2013
    • 911

    Originally posted by darkonix View Post
    I'm not arguing. I agree with what you said. My point that all that C language is embedded in C++. There is no switch to separate both. To write safe code requires a conscious effort that evidently most people can not or will not do.
    Your point "C language is embedded in C++" is only "almost" true. There are a few things in C that are not in C++, but as a C++ programmer you'll not miss these. There are command line switches in (nearly) all compilers that allow you to separate the subsets.

    "To write safe code requires a conscious effort" is a generic truth that is valid even for so called "memory safe" languages. I highly doubt that "most people" are not willing to write safe code. But there are always a few dickheads around that cannot be convinced otherwise. Just look around in this forum.

    Comment

    • back2未來
      Phoronix Member
      • Oct 2023
      • 79

      Originally posted by lowflyer View Post

      Adding the "-pedantic" option to the compiler does not change anything. The code compiles - as it did before. But it still fails at the same place with the same message with both g++ and clang++. I think you don't actually know why it fails.

      The compilers are way too old. clang++ is currently at version 18 and g++ at version 14. And I suggest you also define a more recent C++ standard like C++23 or so by adding:
      Code:
      -std=c++23
      [ it's mostly functional, with adjusted sources and
      Code:
      clang++-14 -pedantic -std=c++20 tmp.cpp -o tmp.clang14.bin
      Code:
      g++-11 -pedantic -std=c++23 tmp.cpp -o tmp.gpp11.bin
      (compilers: ~2.5/3.5yrs since release date)

      With not that much practice in programming, it's more difficult adjusting type conversions within Cpp for 'unknown' libraries (with reading header files and research of compiler warnings/errors) and more distracting from feature building within Rust getting all necessary dependencies inserted (and an overview of available packages/features?), especially creating error messages seems being a more demanding task.
      With a debug(/release) compile target, small Rust programs can get a relatively huge storage requirement (~1-2GB, with several dependency package/feature versions, (easy to choose from versions,) being rebuilt, inside a /target/debug sub directory(?), some report even high ~x0GB sizes for the target/debug/deps folder; a
      Code:
      cargo clean
      clears that, with a next compiling taking longer again.).
      (For what's there with software: Since the build systems also differ, it's not only about source code translation/conversion.)

      Statistics reflecting more attention/demand for C&Cpp, like
      'Most demanded programming languages by recruiters worldwide in 2024'(?)
      • Python ~42%
      • JavaScript ~41%
      • Java ~39%
      • C# ~25%
      • SQL ~24%
      • C++ ~24%
      • Typescript ~23%
      • Html CSS ~22%
      • Php ~18%
      • C ~12%
      • Bash ~7%
      • Go ~6%
      • PowerShell ~4%
      • Ruby ~4%
      • Rust ~3.5%
      • R ~3%
      • Perl ~2%
      • Lua ~1%
      • Fortran/Pascal/Delphi/Haskell/Julia/Tcl ~0.7-0.9%

      (thx) ]
      Last edited by back2未來; 17 December 2024, 03:57 AM.

      Comment

      • lowflyer
        Senior Member
        • Aug 2013
        • 911

        I emphasize the importance of using up-to-date compilers and libraries. Especially since clang-19 and gcc-14 are readily available on all Linux distributions. Likewise, rust developers also no longer use versions from before rust-1.60.0.

        Originally posted by back2未來 View Post
        ... it's more difficult adjusting type conversions within Cpp ...
        Type conversions is a concept originating from the C language. The goal of C++ is to make most type conversions unnecessary. C++ has "type inheritance" to accomplish that and it has made type casts (like "reinterpret_cast<T>()") deliberately ugly to push programmers to write better code.

        Originally posted by back2未來 View Post
        ...
        for 'unknown' libraries (with reading header files and research of compiler warnings/errors) and more distracting from feature building within Rust getting all necessary dependencies inserted (and an overview of available packages/features?), especially creating error messages seems being a more demanding task.
        With debugging enabled, small Rust programs can get a relatively huge storage requirement (~1-2GB, with several dependency package/feature versions inside a /target/debug sub directory(?), yes, some report even high ~x0GB sizes for the target/debug/deps folder, a
        Code:
        cargo clean
        clears that, with a next compiling taking longer again.).
        ...
        Complicated error messages are no longer a big issue with clang and gcc - unless you still work with microsoft compilers, Python or Java.

        You raise an important point about library dependencies. Rust makes it way too easy to add dependencies. That's perhaps the reason why rust is so much liked by web developers.

        Novice C++ programmers often make the mistake to ignore the "Boost" library. And what's worse even the C++ standard library. Boost is easy to install on any Linux system. With it there is rarely a need for other libraries.

        Comment

        • kerosina
          Junior Member
          • Dec 2024
          • 5

          Originally posted by TheMightyBuzzard View Post

          That I have written Rust is precisely why I can say it with absolute certainty. I even contributed to a few crates back before they all started adopting CoCs. The second they did I stopped contributing to them.
          Seeing your [github profile](https://github.com/TheMightyBuzzard), you only ever contributed to perl projects, no Rust projects.

          Comment

          • lowflyer
            Senior Member
            • Aug 2013
            • 911

            Originally posted by TheMightyBuzzard View Post

            That I have written Rust is precisely why I can say it with absolute certainty. I even contributed to a few crates back before they all started adopting CoCs. The second they did I stopped contributing to them.
            I commend you for standing up against these CoC's

            Comment

            Working...
            X