Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Given enough eyeballs - a Sunday rant...

Given enough eyeballs - a Sunday rant...

Scheduled Pinned Locked Moved The Weird and The Wonderful
comhelpquestionannouncementlounge
9 Posts 5 Posters 71 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mircea NeacsuM Offline
    Mircea NeacsuM Offline
    Mircea Neacsu
    wrote on last edited by
    #1

    ... after a frustrating week, this could be taken as a general rant at the quality of open-source software with applications to particular pieces. Given enough eyeballs, where are those eyeballs looking? Surely not at libpng[^] - the reference implementation for the PNG format. It is a smallish library of about 20 kLOC but the configuration file with all the possible options has over 200 different options. That makes for 200x200 = 40k potentially different ways you could build the library. Either that or some of the options are redundant. The code quality is atrocious. I understand that it's a project started in the '90es but that's no excuse for not cleaning it up from time to time. You cannot let one test program get to 12000 lines in a single file. And those 12000 lines are full of miracles like parameters and structure members called this! Don't you worry! At the beginning of the file there is this fragment:

    #ifdef __cplusplus

    define this not_the_cpp_this

    define new not_the_cpp_new

    :omg: Also, if the byzantine compile time configuration options make it impossible for the program to run would you think of throwing an error using a #error directive? NO, good quality open-source code just wraps the whole program in an #if block with the #else clause, 12000 lines below:

    #else /* write or low level APIs not supported */
    int main(void)
    {
    fprintf(stderr,
    "pngvalid: no low level write support in libpng, all tests skipped\n");
    /* So the test is skipped: */
    return SKIP;
    }
    #endif

    Remember: these are compile time conditions; why would you fail at run time? Have you heard of semantic versioning? Well, check this out (straight from the LIBPNG) web site:

    Quote:

    At present, there are eight branches: master (actively developed) libpng16 (equivalent to master) libpng17 (frozen, last updated on 2017-Sep-03) libpng15 (frozen, last updated on 2017-Sep-28) libpng14 (frozen, last updated on 2017-Sep-28) libpng12 (frozen, last updated on 2017-Sep-28) libpng10 (frozen, last updated on 2017-Aug-24) libpng00 (frozen, last updated on 1998-Mar-08)

    These translate in version numbers as 1.6.x, 1.7.x, 1.5.x

    Greg UtasG C 2 Replies Last reply
    0
    • Mircea NeacsuM Mircea Neacsu

      ... after a frustrating week, this could be taken as a general rant at the quality of open-source software with applications to particular pieces. Given enough eyeballs, where are those eyeballs looking? Surely not at libpng[^] - the reference implementation for the PNG format. It is a smallish library of about 20 kLOC but the configuration file with all the possible options has over 200 different options. That makes for 200x200 = 40k potentially different ways you could build the library. Either that or some of the options are redundant. The code quality is atrocious. I understand that it's a project started in the '90es but that's no excuse for not cleaning it up from time to time. You cannot let one test program get to 12000 lines in a single file. And those 12000 lines are full of miracles like parameters and structure members called this! Don't you worry! At the beginning of the file there is this fragment:

      #ifdef __cplusplus

      define this not_the_cpp_this

      define new not_the_cpp_new

      :omg: Also, if the byzantine compile time configuration options make it impossible for the program to run would you think of throwing an error using a #error directive? NO, good quality open-source code just wraps the whole program in an #if block with the #else clause, 12000 lines below:

      #else /* write or low level APIs not supported */
      int main(void)
      {
      fprintf(stderr,
      "pngvalid: no low level write support in libpng, all tests skipped\n");
      /* So the test is skipped: */
      return SKIP;
      }
      #endif

      Remember: these are compile time conditions; why would you fail at run time? Have you heard of semantic versioning? Well, check this out (straight from the LIBPNG) web site:

      Quote:

      At present, there are eight branches: master (actively developed) libpng16 (equivalent to master) libpng17 (frozen, last updated on 2017-Sep-03) libpng15 (frozen, last updated on 2017-Sep-28) libpng14 (frozen, last updated on 2017-Sep-28) libpng12 (frozen, last updated on 2017-Sep-28) libpng10 (frozen, last updated on 2017-Aug-24) libpng00 (frozen, last updated on 1998-Mar-08)

      These translate in version numbers as 1.6.x, 1.7.x, 1.5.x

      Greg UtasG Offline
      Greg UtasG Offline
      Greg Utas
      wrote on last edited by
      #2

      Thanks for the amusing rant! You're saying the implementation of the PNG format is only 20 KLOCs and is a hacked together PoS written in C? I'm stunned no one has rewritten it. That was something that regularly gave me joy! But let me guess. Obscure corners of the spec for which no test images exist? People who'd scream about a breaking change that forced them to revisit magic settings for 200 options? Or just, "if it ain't broke, don't fix it"--which makes sense if it's not seeing new development, but it sounds like it is. And that many developers contributing to it over a long period of time were fearful of breaking it, so most (or all, because of a "policy") enabled their new code with a new option?

      Robust Services Core | Software Techniques for Lemmings | Articles
      The fox knows many things, but the hedgehog knows one big thing.

      <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
      <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

      Mircea NeacsuM 1 Reply Last reply
      0
      • Greg UtasG Greg Utas

        Thanks for the amusing rant! You're saying the implementation of the PNG format is only 20 KLOCs and is a hacked together PoS written in C? I'm stunned no one has rewritten it. That was something that regularly gave me joy! But let me guess. Obscure corners of the spec for which no test images exist? People who'd scream about a breaking change that forced them to revisit magic settings for 200 options? Or just, "if it ain't broke, don't fix it"--which makes sense if it's not seeing new development, but it sounds like it is. And that many developers contributing to it over a long period of time were fearful of breaking it, so most (or all, because of a "policy") enabled their new code with a new option?

        Robust Services Core | Software Techniques for Lemmings | Articles
        The fox knows many things, but the hedgehog knows one big thing.

        Mircea NeacsuM Offline
        Mircea NeacsuM Offline
        Mircea Neacsu
        wrote on last edited by
        #3

        C:\development\png\src>cloc *.c
        15 text files.
        15 unique files.
        0 files ignored.

        github.com/AlDanial/cloc v 2.00 T=0.11 s (134.0 files/s, 275793.4 lines/s)

        Language files blank comment code

        C 15 4626 5400 20838

        SUM: 15 4626 5400 20838

        Greg Utas wrote:

        is a hacked together PoS written in C?

        I wouldn't go to call it a PoS, but certainly in dire need of a cleanup.

        Mircea

        Greg UtasG C 2 Replies Last reply
        0
        • Mircea NeacsuM Mircea Neacsu

          C:\development\png\src>cloc *.c
          15 text files.
          15 unique files.
          0 files ignored.

          github.com/AlDanial/cloc v 2.00 T=0.11 s (134.0 files/s, 275793.4 lines/s)

          Language files blank comment code

          C 15 4626 5400 20838

          SUM: 15 4626 5400 20838

          Greg Utas wrote:

          is a hacked together PoS written in C?

          I wouldn't go to call it a PoS, but certainly in dire need of a cleanup.

          Mircea

          Greg UtasG Offline
          Greg UtasG Offline
          Greg Utas
          wrote on last edited by
          #4

          There's actually a reasonable number of comments and blanks!

          Robust Services Core | Software Techniques for Lemmings | Articles
          The fox knows many things, but the hedgehog knows one big thing.

          <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
          <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

          1 Reply Last reply
          0
          • Mircea NeacsuM Mircea Neacsu

            C:\development\png\src>cloc *.c
            15 text files.
            15 unique files.
            0 files ignored.

            github.com/AlDanial/cloc v 2.00 T=0.11 s (134.0 files/s, 275793.4 lines/s)

            Language files blank comment code

            C 15 4626 5400 20838

            SUM: 15 4626 5400 20838

            Greg Utas wrote:

            is a hacked together PoS written in C?

            I wouldn't go to call it a PoS, but certainly in dire need of a cleanup.

            Mircea

            C Offline
            C Offline
            charlieg
            wrote on last edited by
            #5

            "cloc *.c" Dear Jesus, I miss the command line. I really need to go back to Unix development. Or go on a car camping road trip alone...

            Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

            T 1 Reply Last reply
            0
            • C charlieg

              "cloc *.c" Dear Jesus, I miss the command line. I really need to go back to Unix development. Or go on a car camping road trip alone...

              Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

              T Offline
              T Offline
              trønderen
              wrote on last edited by
              #6

              In my last job, we needed to know the number of code / blank / comment / hash / blockdelimiter-only lines in various languages (with different comment markers and block delimiters), as well as code lines with embedded or end-of-line comments. Coding it wasn't much above the 'trivial' level. Setting up a standard directory search dialog, a set of check boxes for file selection on type and optionally name, traversing/filtering the selected directories are straightforward, standard tasks. Actually, my biggest problem was handling those files that were themselves processing source code: They frequently contained string values that were comment start/end, confusing the search for "real" comment markers. And nested comments were nasty. I didn't have the resources for writing full parsers for all the languages in question, so I did a few dirty shortcuts; I am not sure if nested comments always were counted 100% correctly, but the assignment called only for an 'estimate', reporting in KLOCs, not exact values, so it was 'good enough'. The functionality went significantly beyond cloc. The tree traversal and file analysis (i.e. line counting) was somewhere around 400 lines of C# code. So, if you really miss it badly: Sit down and code it, with a GUI interface.

              Religious freedom is the freedom to say that two plus two make five.

              C 1 Reply Last reply
              0
              • T trønderen

                In my last job, we needed to know the number of code / blank / comment / hash / blockdelimiter-only lines in various languages (with different comment markers and block delimiters), as well as code lines with embedded or end-of-line comments. Coding it wasn't much above the 'trivial' level. Setting up a standard directory search dialog, a set of check boxes for file selection on type and optionally name, traversing/filtering the selected directories are straightforward, standard tasks. Actually, my biggest problem was handling those files that were themselves processing source code: They frequently contained string values that were comment start/end, confusing the search for "real" comment markers. And nested comments were nasty. I didn't have the resources for writing full parsers for all the languages in question, so I did a few dirty shortcuts; I am not sure if nested comments always were counted 100% correctly, but the assignment called only for an 'estimate', reporting in KLOCs, not exact values, so it was 'good enough'. The functionality went significantly beyond cloc. The tree traversal and file analysis (i.e. line counting) was somewhere around 400 lines of C# code. So, if you really miss it badly: Sit down and code it, with a GUI interface.

                Religious freedom is the freedom to say that two plus two make five.

                C Offline
                C Offline
                charlieg
                wrote on last edited by
                #7

                I agree. Of course, this can be done. I just miss the cleanliness of Unix as compared to the 5 headed hydra monstrosity that Windows has become. VS2022 is so bloated, we should bring back whaling and turn it into oil.

                Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                1 Reply Last reply
                0
                • Mircea NeacsuM Mircea Neacsu

                  ... after a frustrating week, this could be taken as a general rant at the quality of open-source software with applications to particular pieces. Given enough eyeballs, where are those eyeballs looking? Surely not at libpng[^] - the reference implementation for the PNG format. It is a smallish library of about 20 kLOC but the configuration file with all the possible options has over 200 different options. That makes for 200x200 = 40k potentially different ways you could build the library. Either that or some of the options are redundant. The code quality is atrocious. I understand that it's a project started in the '90es but that's no excuse for not cleaning it up from time to time. You cannot let one test program get to 12000 lines in a single file. And those 12000 lines are full of miracles like parameters and structure members called this! Don't you worry! At the beginning of the file there is this fragment:

                  #ifdef __cplusplus

                  define this not_the_cpp_this

                  define new not_the_cpp_new

                  :omg: Also, if the byzantine compile time configuration options make it impossible for the program to run would you think of throwing an error using a #error directive? NO, good quality open-source code just wraps the whole program in an #if block with the #else clause, 12000 lines below:

                  #else /* write or low level APIs not supported */
                  int main(void)
                  {
                  fprintf(stderr,
                  "pngvalid: no low level write support in libpng, all tests skipped\n");
                  /* So the test is skipped: */
                  return SKIP;
                  }
                  #endif

                  Remember: these are compile time conditions; why would you fail at run time? Have you heard of semantic versioning? Well, check this out (straight from the LIBPNG) web site:

                  Quote:

                  At present, there are eight branches: master (actively developed) libpng16 (equivalent to master) libpng17 (frozen, last updated on 2017-Sep-03) libpng15 (frozen, last updated on 2017-Sep-28) libpng14 (frozen, last updated on 2017-Sep-28) libpng12 (frozen, last updated on 2017-Sep-28) libpng10 (frozen, last updated on 2017-Aug-24) libpng00 (frozen, last updated on 1998-Mar-08)

                  These translate in version numbers as 1.6.x, 1.7.x, 1.5.x

                  C Offline
                  C Offline
                  Chris Maunder
                  wrote on last edited by
                  #8

                  Quote:

                  # define this not_the_cpp_this

                  I'm refactoring my code now to follow this pattern. May future maintainers writhe in pain.

                  cheers Chris Maunder

                  Mircea NeacsuM 1 Reply Last reply
                  0
                  • C Chris Maunder

                    Quote:

                    # define this not_the_cpp_this

                    I'm refactoring my code now to follow this pattern. May future maintainers writhe in pain.

                    cheers Chris Maunder

                    Mircea NeacsuM Offline
                    Mircea NeacsuM Offline
                    Mircea Neacsu
                    wrote on last edited by
                    #9

                    You succumbed to the the power of the dark side[^] :laugh:

                    Mircea

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups