• Flipper ( Flipper@feddit.org ) 
    link
    fedilink
    arrow-up
    79
    ·
    edit-2
    9 months ago

    Has the same vibes as anthropic creating a C compiler which passes 99% of compiler tests.

    That last percent is really important. At least that last percent are some really specific edge cases right?

    Description:
    When compiling the following code with CCC using -std=c23:

    bool is_even(int number) {
       return number % 2 == 0;
    }
    

    the compiler fails to compile due to bool, true, and false being unrecognized. The same code compiles correctly with GCC and Clang in C23 mode.

    Source

    Well fuck.

    • PlexSheep ( PlexSheep@infosec.pub ) 
      link
      fedilink
      arrow-up
      17
      ·
      9 months ago

      If this wasn’t 100% vibe coded, it would be pretty cool.

      A c compiler written in rust, with a lot of basics supported, an automated test suite that compiles well known c projects. Sounds like a fun project or academic work.

    • sus ( sus@programming.dev ) 
      link
      fedilink
      arrow-up
      2
      ·
      9 months ago

      The incredible thing is this is actually the result of an explicit design decision.

      The compiler accepts most GCC flags. Unrecognized flags (e.g., architecture- specific -m flags, unknown -f flags) are silently ignored so ccc can serve as a drop-in GCC replacement in build systems.

      They’re so committed to vibing that they’d prefer if the compiler just does random shit to make it easier to shove it haphazardly into a build pipeline.

  • I’m struggling to follow the code here. I’m guessing it’s C++ (which I’m very unfamiliar with)

    bool is_prime(int x) {
        return false;
    }
    

    Wouldn’t this just always return false regardless of x (which I presume is half the joke)? Why is it that when it’s tested up to 99999, it has a roughly 95% success rate then?

  • Kekzkrieger ( Kekzkrieger@feddit.org ) 
    link
    fedilink
    English
    arrow-up
    9
    ·
    9 months ago

    If you think this is bad and not nearly enough accuracy to be called correct, AI is much worse than this.

    It’s not just wrong a lot of times or hallucinates but you can’t pinpoint why or how it produces the result and if you keep putting the same data in, the output may still vary.

  • CanadaPlus ( CanadaPlus@lemmy.sdf.org ) 
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    9 months ago

    I mean, an application could exist where this isn’t even wrong. Maybe as a “subroutine” of another algorithm that only needs a truly composite number most of the time to work.

    That this reads as a joke says a lot about what application we’re intuitively expecting.

    Edit: Not sure why this is being downvoted.

      • That’s kind of what I meant by putting “subroutine” in quotes. You obviously wouldn’t write it like this, you’d just use a random large number with a bit of explanation.

        Oh well, live and learn. I’ll try to be clearer next time.

        • ulterno ( ulterno@programming.dev ) 
          link
          fedilink
          English
          arrow-up
          1
          ·
          9 months ago

          I just took the above comment as continuing the joke, but this explanation actually confuses me more.
          Well, I don’t really think you need to be very clear in this case. Jokes are more fun when you “get” them rather than have them explained.

          • CanadaPlus ( CanadaPlus@lemmy.sdf.org ) 
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            9 months ago

            I get OP was a joke, but I was trying to make a serious observation.

            Say you have some kind of stochastic algorithm that works on the assumption it’s fed a composite number most of the time. Maybe something like Pollard’s Rho algorithm, where whatever number theoretic structure you need accumulates slowly over time as a result. You decide to just pick a large number at random for each iteration.

            Implicitly, you’ve solved the problem of finding a composite number by assuming all (large) numbers are composite, like in this post. It is pretty close, like also mentioned in this post. If that’s not good enough, you could also use a primality test that fails some small portion of the time, which do exist, and use less power than guaranteed tests.