C vs. C++: the great debate

Home Forums Science & Tech C vs. C++: the great debate

Viewing 41 reply threads
  • Author
    Posts
    • #77992
      Anonymous
      Guest

      The great debate

    • #77993
      Anonymous
      Guest

      the former.

      • #78007
        Anonymous
        Guest

        >be me garden gnome
        >I read right to left
        C++ is superior.

        • #78010
          Anonymous
          Guest

          i can’t help retarded people, sorry.

    • #77994
      Anonymous
      Guest
      • #77998
        Anonymous
        Guest

        booba

      • #78041
        Anonymous
        Guest

        Boobs are bloat

      • #78062
        Anonymous
        Guest
        • #78079
          Anonymous
          Guest

          >C#
          lol. good joke. shilling for dead windows-only language.

          • #78087
            Anonymous
            Guest

            Werks just fine on my Linux machine.

            • #78111
              Anonymous
              Guest

              >C#
              >Werks

              • #78124
                Anonymous
                Guest

                Indeed, it does.

    • #77996
      Anonymous
      Guest

      It’s always Rust, unless you’re a boomer or a neet pretending to be a boomer.

      • #78005
        Anonymous
        Guest

        based

      • #78085
        Anonymous
        Guest

        If you really want safe code there are tools for formally verifying C.
        >but formal verification takes too long
        Formal verification is the only way to write safe code. If you didn’t write a spec for all your functions, and you didn’t prove that those functions match their specs, your program by definition has undefined behavior. Or you can just be content with the fact that your code has bugs, and try to decrease the number of bugs to a tolerable level.

        • #78088
          Anonymous
          Guest

          this, rust literally doesnt have a spec, how can it claim to be safe. every line of rust code is undefined behavior.

          • #78114
            Fake Gamer
            Guest

            That is not what UB is. The compiler prevents anything that would cause UB. The only way you can have UB in a Rust program is by doing retarded shit with unsafe.

      • #78129
        Anonymous
        Guest

        They’re both obsolete. We have Rust now.

        lmk when you can make a linked list in rust without it screaming and pissing everywhere
        >unsafe rust
        then what’s the fucking point of your stupid language?

    • #77997
      Anonymous
      Guest

      Reminder that assembly is in the top 20
      Time to roll up your sleeves boy

    • #77999
      Anonymous
      Guest

      C to LARP as a ""simplicity"" loving unix greybeard, C++ for grungy real world projects

      • #78013
        Anonymous
        Guest

        >LARP as a ""simplicity"" loving unix greybeard
        I want to be this unironically.

        greybeards gatekeep, they have life-long jobs, and they get paid very well for doing nothing.

        • #78118
          Anonymous
          Guest

          you’re already worthless, so halfway there

    • #78000
      Anonymous
      Guest

      C++ without virtual methods and STL

      • #78001
        Anonymous
        Guest

        You mean C++ with only completely abstract base classes for interfaces and no multilevel inheritance and lots of stdlib

        • #78028
          Anonymous
          Guest

          No point for interfaces when there is function overloading and parametric polymorphism with templates and concepts.

          • #78029
            Anonymous
            Guest

            Yes there is. It’s called compile time reduction by hiding implementations. But you’d only know that if you had ever worked on a real project (btw almost no one uses anything newer than c++17).

            in b4
            >virtual calls are slow
            devirtualization and lto are things faggots

            • #78091
              Anonymous
              Guest

              >bypass language features for the sake of muh fast coompilation

      • #78015
        Anonymous
        Guest

        You might as well use C at this point and enjoy faster compile times and better tooling support.

      • #78032
        Anonymous
        Guest

        based retard.

    • #78002
      Anonymous
      Guest

      C++ but without the stupid C++ spaghetti code bloated OO trash, basically write C++ like C while still using the good parts of C++ to enhance it.

    • #78003
      Anonymous
      Guest

      > Crap vs Crap++
      hard choice

    • #78004
      Anonymous
      Guest

      C
      /thread

    • #78006
      Anonymous
      Guest

      Python

    • #78008
      Anonymous
      Guest

      They’re both obsolete. We have Rust now.

      • #78009
        Anonymous
        Guest

        rust is a joke.
        it will be dead in a year or two, just like all those ‘killer-languages’ in the last 10 years that nobody even remembers now

        • #78027
          Anonymous
          Guest

          >gets unironically considered for usage in the linux kernel
          >calls it dead
          seethe, cnile

          what does it have that changes the game? c is beyond simple, it’s literally human-readable low level language. what does rust ***actually*** have that makes it useful for any task?

          the problem is that c is too simple. to do anything useful requires you to think about the specifics. take this idea to the extreme and sprinkle in some math, you get haskell. however, take this idea to "features that require 0 cost" and you get C++. take C++, remove its retardedness, you get rust.
          rust is well designed through and through, the fact that so many people are seething about it here is enough to say something significant – nobody seethes over rust as hard like they do haskell.

          if you ask "why is rust good?", then ask yourself "why is c++ good?" and remove the bad parts about c++. more abstractions at zero runtime cost, RAII to prevent you from forgetting to free stuff, iterators to allow you to combine iteration in meaningful ways at zero cost, etc. taking this idea even further and removing the stuff that makes c++ so highly prone to bugs you get rust, where you prevent buffer overflows and weird aliasing rules and copy constructors and implicit copy constructors and all that garbage

          • #78030
            Anonymous
            Guest

            rust is only considered by trannies
            and because of today’s sick tolerance nobody says firm "No"
            everyone knows rust will soon die on its own
            and then it will quietly be purged from any Linux interest
            pic very related
            rust is dead

            • #78057
              Anonymous
              Guest

              > Soon die
              Rust is barely even marketed right now, and is growing fast. Its kept alive by virtue of how much people hate the alternatives. Sorry to say, its not going anywhere.

              • #78061
                Anonymous
                Guest

                >Rust is barely even marketed right now
                What planet are you on? Rust is the most heavily shilled programming language that exists right now.

          • #78031
            Anonymous
            Guest

            >take this idea to "features that require 0 cost" and you get C++
            The main problem with C++’s "abstractions" is not that they are supposedly zero cost (after all some abstractions actually are zero cost, not just in C++), it’s that they are so leaky that they aren’t abstractions at all. The standard library is badly designed and the language itself isn’t very good at building powerful abstractions, despite what Bjarne claims.

            Take std::vector: breaking its invariants is extremely easy, all it takes is a "direct" insertion via the subscript operator. This doesn’t work because inserting elements in such a way doesn’t update the internal counter, therefore size() will return the wrong value.
            Now, you could say "don’t use subscript operators, use push_back". Which is correct, but this basically means that you have to have to be aware of the internals of the vector object at all times. But isn’t removing need to worry about implementation details the main point of abstraction in the first place?
            std::vector is just one example. the standard library (and many codebases) are full of these non-abstractions. They just overcomplicate the overall structure of the program while not providing an actual reduction in mental overhead.

            A leaky, badly designed abstraction is worse than no abstraction at all.

            • #78038
              Anonymous
              Guest

              joel used to be cool and informative, now its just a cringefest

              • #78044
                Anonymous
                Guest

                literally who

            • #78065
              Anonymous
              Guest

              >a "direct" insertion via the subscript operator.
              std::vector has no such feature. This OOB access is explicitly UB; the standard library is free to assume or assert index < size() in the indexer’s implementation.
              tl;dr read the fucking manual.

              • #78066
                Anonymous
                Guest

                You are just proving the point even further. You have to be so aware of the internals that it defeats the point of abstraction in the first place.

                • #78068
                  Anonymous
                  Guest

                  It has nothing to do with the internals. You use [] to access an element, and push_back for insertion. You can’t use [] to access an element that doesn’t exist, that won’t work in any non-retarded language/library, not even Rust.

                  • #78070
                    Anonymous
                    Guest

                    That means you have to be aware of the internals. You have to pay even more attention to it than a plain array, which is ridiculous considering that it’s meant to be a more general abstraction.

                    I really don’t understand the point you’re trying to make here. std::vector is not a good abstraction.

                    • #78086
                      Anonymous
                      Guest

                      >std::vector is not a good abstraction.
                      It actually is though. But feel free to stay wrong.

                      • #78100
                        Anonymous
                        Guest

                        You have to be aware of the internals to use it => it’s a bad abstraction. Stop coping.

                      • #78125
                        Anonymous
                        Guest

                        You don’t. But you already knew that.
                        >muh cope
                        I accept your concession.

            • #78078
              Anonymous
              Guest

              >Take std::vector: breaking its invariants is extremely easy, all it takes is a "direct" insertion via the subscript operator. This doesn’t work because inserting elements in such a way doesn’t update the internal counter, therefore size() will return the wrong value
              The reason for this is because the subscript operator is supposed to be a fast way of doing things if the operator can make guarantees that the index is valid, if you had to update the size of you inserted after the end you’d literally have to implement a check for every call to [] defeating its purpose.

              • #78101
                Anonymous
                Guest

                >you’d literally have to implement a check for every call to [] defeating its purpose.
                That’s what the at() method does.

                Again, you have to worry that the subscript operator may not be valid precisely because it leakily abstracts over a plain array. At this point, you’d be better off just using a dynamic array.

            • #78104
              Anonymous
              Guest

              >waaaaah this extremely convenient class has a caveat so it’s baaad and nobody should use it!!!11!
              I am so glad people like you have no impact on the professional world.

              • #78106
                Anonymous
                Guest

                Even if that were true, it wouldn’t change the fact that most classes in the standard library are plain bad abstractions.

                You’re free to make a serious attempt at a relevant post next time.

                • #78107
                  Anonymous
                  Guest

                  They are great, and you are nitpicking minor flaws, flaws which still leave them being much better than suffering through the use of C.

                  • #78110
                    Anonymous
                    Guest

                    You have nothing interesting to say, I doubt you even use C++.
                    >no u r dum
                    >no they r great

              • #78108
                Anonymous
                Guest

                >t. never used memcpy on a vector’s data()

      • #78011
        Anonymous
        Guest

        what does it have that changes the game? c is beyond simple, it’s literally human-readable low level language. what does rust ***actually*** have that makes it useful for any task?

        • #78018
          Anonymous
          Guest

          unironically the borrow checker

          • #78019
            Anonymous
            Guest

            whats the point if you have to wrap everything in Rc and RefCells anyway?

            • #78021
              Anonymous
              Guest

              because its explicit. if its getting used everywhere, then there’s something wrong with the program design. I’ve seen libraries that do this, almost always there are alternatives with much simpler APIs that are faster as well because the design they created conforms better to borrow checker rules

              • #78023
                Anonymous
                Guest

                >almost always there are alternatives
                what are those exactly?

                • #78024
                  Anonymous
                  Guest

                  Using the C FFI, for example

        • #78025
          Anonymous
          Guest

          They require static analysis to be a part of the compilation process. That’s all

        • #78034
          Anonymous
          Guest

          > human-readable low level
          Your assembly output ends up looking nothing like C, not even in the slightest. C is miles and miles above the machine in terms of abstraction.

          • #78036
            Anonymous
            Guest

            Less miles than most other languages, though.

          • #78092
            Anonymous
            Guest

            your brain is minuscule. If you’ve ever actually written and compared code implementing the same things in assembly and in C or C++ structures like loops look almost identical

    • #78012
      Anonymous
      Guest

      C is a flawed and badly designed language (even by the standards of the time).

      Nevertheless, it’s still better than C++. C++ doesn’t solve any of the problems of C while adding even more issues on top. The latest standards made the overall situation even worse, causing additional fragmentation and bloat.
      The only reason it’s still used at all is legacy codebases existing and past successful marketing (just look at how it sells itself even in the name: C++, C, but better).

      Both languages should be avoided whenever possible. But if I have to choose between C and C++, I choose C every time.

      • #78016
        Anonymous
        Guest

        Luckily you are unemployed and have no effect on the real world

        • #78017
          Anonymous
          Guest

          Even if that were true, it would be completely irrelevant to the discussion.

    • #78014
      Anonymous
      Guest

      you faggots larp as C/C++ programmers because you know you can’t actually build anything in languages people actually use and build stuff on, so you just printf on main and run you little terminal programs for the rest of your life

      you will never be a programmer
      you will never get a job

      • #78096
        Anonymous
        Guest
      • #78119
        Anonymous
        Guest

        I am a C/C++ programmer, and I know for a fact a pajeet can never replace me.
        Can you say the same? Hardmode: no larping as some genius that 10 pajeets can’t replace.

        • #78121
          Anonymous
          Guest

          only when they decide to kick you out and replace the code with java/C#. Dont know if that ever happens

          • #78122
            Anonymous
            Guest

            Never heard of military embedded systems using C# or Java. Rust is too bloated and too much involved in progressive bullshit to be picked up by firms like the one I work for.

            • #78123
              Anonymous
              Guest

              >Never heard of military embedded systems using C# or Java
              I was thinking more of business/enterprise software
              >Rust is too bloated
              normally you hear the opposite, that C++ (or just STL?) is too bloated and Rust is lean for embedded. Do you use STL at your job?
              I have some talks bookmarked about embedded C++, but is embedded too different from ‘normal’ yet high-performance C++ (desktop) development? To me at first glance, they both seem quite similar for the most part.

    • #78022
      Anonymous
      Guest

      C#

    • #78033
      Anonymous
      Guest

      assembly

    • #78035
      Anonymous
      Guest

      I feel like the general feeling tend to air on the side of C++ if your writing your own code. C if the code is going to have to be maintained and modified by different people.

    • #78037
      Anonymous
      Guest

      ADA

    • #78039
      Anonymous
      Guest

      vs HOLY C

      • #78056
        Anonymous
        Guest

        Fucking based.
        Also, is there a way to learn HolyC without Temple OS. Is there a compiler for it that I’m not aware of or it’s only exclusive to the OS? I want to write programs using the language. Heard it beats C and C++ in every way.

        • #78059
          Anonymous
          Guest

          TempleOS is open, you learn in about 6 month everything you need to do everything you want with this operating system.

    • #78040
      Anonymous
      Guest

      Dead boomer language vs dying boomer language

    • #78042
      Anonymous
      Guest

      Used sensibly C++ provides a lot of useful, language, facilities over C. The destructor being perhaps the most useful. But there are some costs and complications.
      The standard library is a mixed bag of worms and the committee have no sense of ergonomics. But there’s a lot in there that can be employed without too much pain and a lot that can be ignored.
      The C++ community is the worst part. They are mostly fucktards who relish in a mis-guided and unwarranted belief they are superior to other developers and that the current C++ way (it keeps changing over the decades I’ve used it) are the one-true-way (much like the Rust proponents) and are often quick to disregard complaints about its obvious failings.
      All that said, C++ can be useful in place of C if you’re willing to disregard the bullshit.

      • #78058
        Anonymous
        Guest

        Well said.

        I think that far fewer people would hate C++ if its proponents admitted the presence of flaws when pointed out.
        Instead, you always get snarky remarks of the form "you just don’t get it", which leads to people just hating the language even more.

    • #78049
      Anonymous
      Guest

      >mortar vs bricks
      Burger fingers typed this post

    • #78052
      Anonymous
      Guest

      C++ but without all the crud and readable syntax i.e. Nim

    • #78053
      Anonymous
      Guest

      What is the difference between C and C++ is C++ just C with more stuff will C programs compile with a C++ compiler?

      • #78054
        Anonymous
        Guest

        Yes but also no but usually yes except when no

        • #78055
          Anonymous
          Guest

          What the fuck dose that mean?

          • #78060
            Anonymous
            Guest

            YES BUT PERHAPS NO HOWEVER POSSIBLE ALTHOUGH CONSIDERING EVERYTHING POTENTIALLY NO AND YET EVEN WITH ALL THAT SAID IT MAY IN FACT BE DOABLE

      • #78082
        Anonymous
        Guest

        C++ is the same basic shit as C but then they take bloat and ++ it. They add a bunch of useless shit that slows down the compiler, and using it will multiply the slowness further and lower performance. But for monkeys that have no ability to do logic reasoning, it’s helps as they can replace logic with abstractions and syntax, which is pure memorization.

    • #78072
      Anonymous
      Guest

      Objective-C

    • #78073
      Anonymous
      Guest

      golang

    • #78074
      Anonymous
      Guest

      >all numeric data is encoded as double or long int everything else is std::string with an encoding/decoding rule
      >set, tuple, vector, and map are the only used containers
      >runtime polymorphism is solved by 1 level deep virtual classes
      Boom C++ is piss easy to use and you can do 99.5% of the stuff you need to do

    • #78075
      Anonymous
      Guest

      go

    • #78076
      Anonymous
      Guest

      C has better tools.

    • #78089
      Anonymous
      Guest

      I HATE EXCEPTIONS

    • #78093
      Anonymous
      Guest

      >Oh you want to install this text editor?
      >Here you go, also take these, and these, and these…
      C++ can fuck right off.

      • #78095
        Anonymous
        Guest

        visual c++ is a different programming language you nignog

    • #78094
      Anonymous
      Guest

      there is no debate, both have their own legitimate use cases, have a nice day

    • #78097
      Anonymous
      Guest

      C for small programs written for fun.
      C++ for large projects.

    • #78098
      Anonymous
      Guest

      PROGRAMMING FOR ANYTHING OTHER THAN TO PLEASE AND ENTERTAIN GOD IS melanoidLICIOUS

    • #78099
      Anonymous
      Guest

      most of you fags have 0 knowledge of C++ and it shows lmao

      • #78102
        Anonymous
        Guest

        Nobody knows C++ well.

    • #78103
      Anonymous
      Guest

      C++ is great in moderation, but it never stays that way.
      Full C++ style code bases, are impossible to understand or maintain, so much complex behavior hidden behind innocent looking statements, so much OO boilerplate, with getters and setters and other OO masturbation that does not do anything but obscure the actual logic. There is also the extreme bloat, c++ code is 20% faster than C but 500% bigger binary.
      I use C++ as my main language, but wish it was never invented, its like an addiction which you know is bad for you, but you can’t go back to living without it.

      • #78105
        Anonymous
        Guest

        See, people like you at least are honest. Just because you happen to use C++, maybe even as your primary programming language, doesn’t mean you can’t recognize its obvious flaws. I prefer other languages, but I will openly admit that they are flawed and could be improved.

        The thing that drives me insane the most about C++ is not even the language itself, it’s the fanboys who insist that it’s perfect and those who have anything against it "just don’t get it".

        Now, while this is technically an appeal to authority and says nothing about the language itself, the fact that many competent and influential programmers publicly expressed dislike for C++ shows that even people who are more than capable of "getting it" can end up hating it.

    • #78109
      Anonymous
      Guest

      Why not just pick a language that has it all?

      • #78116
        Anonymous
        Guest

        >JS
        >Safe

    • #78112
      Anonymous
      Guest

      Writing big programs in C is unfeasible for your average asshat coder.
      C++ makes it easier to reduce damage done by each individual asshat coder with architecture enforced on syntax level.

    • #78113
      Anonymous
      Guest

      When I google some libraries, they are all written in pure C.
      Why do I have to google some wrappers for them?
      I just might not use C++

    • #78115
      Anonymous
      Guest

      C is about as small as any language where you can properly build abstractions can be. If you look at "char *" or "char arr[]" and say "string", then it’ll suck for you and you’ll make it suck for everyone else.

      C++, with all its flaws both real and imagined, is more accessible, but still too low level for the average programmer to feel comfortable with. If you don’t understand C, you’re probably a terrible C++ programmer.

      Most people should use a higher level language than either because it’s too much to ask for them to appreciate the power and pitfalls that lower-level languages expose them to.

      • #78120
        Anonymous
        Guest

        I failed to receive this message because the constructor threw an exception

    • #78117
      Anonymous
      Guest

      I wonder how much C++ hate is results from differences between different groups’ standards. Imo the language itself is fine.

      I worked with one absolutely beautiful modern C++ codebase (which was just adding C++20 Concepts as I was leaving); standards were enforced, pre/post-conditions were clear, and things were very explicit, either via code or doxygen comments. The program structure was clear. Testing was thorough.

      The current C++ codebase I work in is rather ugly. A mix of C and C++, as there are some mallocs and raw new’s/delete (which could be RAII’d away). There are (unncessary) macros everywhere, some even just all lowercase letters. Lack of consistency. Things done, seemingly without any reason. Repeated code. Hardly any tests. Things often break on release and it means that us developers actually spend at least half the time just running shit and looking at it to check/guess if it’s not broken. Certain abstractions hinder understanding. But my complaints here really have nothing to do with the language.

    • #78128
      Anonymous
      Guest

      inb4
      >language features
      nigga wtf does this dumb bullshit even mean
      there’s no "features" in programming, it’s a fucking list of instructions for the processor
      whatever this shit means, it’s not a "feature", it’s a distraction from what you’re actually doing

Viewing 41 reply threads
  • You must be logged in to reply to this topic.