There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

ThatFembyWho ,

Yeah the constant stream of critical CVEs affecting C/C++ libraries that get patched on my computer is legitimately frightening. So much low quality (and dangerous) code out there. Maybe if you have a personal project that doesn’t connect to another device… you could be justified in writing C code. Or tiny embedded systems?

Modern C++ is actually pretty good. The language gets knocked firstly because it’s complex, and secondly a lot of people remember the old pre-C++11 days. It’s like a different language now.

But it’s a looong way from being my favorite language. That goes something like Python… by a lot; Rust; JavaScript; C# and then everything else.

hlqxz ,

At least he looks happy hating on something else

yoz ,

My dad wanted to me to become a developer. He bought me a computer so that I can code but instead I was introduced to the world of porn. Today I am successful Porn director who has worked for many big name companies.

Thanks dad🥰

TheAnonymouseJoker ,
@TheAnonymouseJoker@lemmy.ml avatar

Hey, cast me! My perversions with the computer jacks and slots is unmatched!

Mechaguana ,
@Mechaguana@programming.dev avatar

I love c++.

That is all.

pingveno ,

That’s okay, everyone has the right to be wrong.

slaveOne ,

It’s not a right if it’s wrong

Zacryon ,

Pfft. You’re just afraid of pointers.

pingveno ,

And I love references. Bring on the Rust lifetimes!

pftbest ,

Some people have weird fetishes too, I won’t judge.

Zacryon ,

Me too. Have been programming in C++ since I was 10 years old. The first programming language I’ve learned and the one I still love using today where appropriate for the task at hand.

onlinepersona ,

I’m happy so many people despise C and C++. Maybe we can move on from it someday and use more memory safe languages that are easier to read. Languages with usable package managers, linting, documentation generation, IDEs, embedded debuggers, helpful stacktraces, readable errors, sane standard libraries, with less arcane invocations of evil.

Honestly, I hope the linux kernel manages to be rewritten in Rust someday.

Zink ,

I am almost a year into a job where the main piece of software is a mix of C and C++ and there is no documentation, hardly even code comments. Some of the files say they were created over a decade ago. Just pages and pages of C code with no comments and no external design docs.

If I search my local copy of the source for .c and .cpp files, I get 1,485 items. But it’s not that bad because many files show up several times in different directories with the same name. :D

And you know, I HAVE been feeling better about myself lately! (The job is actually a perfect fit for me, other than the humongous scary & opaque code base)

Sharpiemarker ,

You’ve got your work cut out for you

dylanTheDeveloper ,
@dylanTheDeveloper@lemmy.world avatar

As someone who switches between C++ and C and besides classes and inheriting what’s the actual difference between native C++ and C? Never really explored beyond Unreals macro heavy version of C++, wxwidgets and QT

TopRamenBinLaden ,

C++ is a superset of C, and C is a subset of C++. C++ was originally designed for the purpose of updating and adding OOP to C.

The main things C++ has that C doesn’t are user defined data types, support of reference variables, function overloading/overriding, built in exception handling with try/catch, inline functions, and C++ has around 30 more keywords overall.

I would say the biggest difference is the OOP focus of C++ where all of data and functions are encapsulated into an object. This helps make C++ more secure and better for writing high level implementations than C.

VictoryRoad ,

And namespaces! And strongly typed enumerators! And templates! And type deduction! And…!

Sylvartas ,

And actual nullpointer definition !

dylanTheDeveloper , (edited )
@dylanTheDeveloper@lemmy.world avatar

Ahh so the whole create a object from a class thing actually works in native C++. So I can create child classes aswel and do cool stuff like casting.

Don’t laugh okay I thought C++ through Unreal Engine was vastly different from native C++ (because that’s what I learnt first)

Never actually used classes when I was playing with native C++. Couldn’t think of anything simple to make that would require it

Chobbes ,

C++ is technically a completely different programming language to C, but they share a lot of similarities because C++ is sort of derived from C (and now they’ve both evolved somewhat separately). The main addition at the start was OOP being baked in to C++. A typical C program is often a valid C++ program as well, but there are some subtle differences in a few areas that can cause problems. C++ has a lot of features compared to C, a more complex type system, a big templating system for compile-time computation, and focuses a lot on adding low/no cost abstractions to make writing programs easier without incurring a high cost at run-time… That said many people do still prefer C, often for its simplicity in comparison.

DharkStare ,

Although I haven’t used it since college, I actually liked C++ especially once I understood pointers.

wim , (edited )

Everything is fine within the scope of a college course or project.

Where C++ breaks down is large, complicated projects where you colaborate with other developers over multiple years.

I worked in C++ for almost a decade, and while there were a few good projects I encountered, most suffered from one or more of the following problems:

  • C++ has so many parts, everyone picks a subset they think is “good”, but noone seems to fully agree on what that subset is.
  • A side effect of the many possibilities C++ offers to compose or abstract your project is that it allows for developers to be “clever”. However, this often results in code that is hard to maintain or understand, especially for other developers.
  • Good C++ is very hard. Not everyone is a C++ veteran that read dozens of books or has a robust body of knowledge on all its quirks and pitfalls, and those people are also often assigned to your project and contribute to it. I was certainly never an expert, despite a lot of time and effort spent learning and using C++.
257m , (edited )

Just use C. It solves all those problens given the most complicated feature is pointers and those hard aren’t to understand.

wim ,

While C is certainly better for some problems in my experience, it too is very hard to use in large projects with a mix of developers, and it is unsuitable for most higher level applications in most companies.

I think C has its place in the world still, which is mostly confined low level embedded, kernel space and malware. I do believe that the market segment that used to rely on C++ is today better served by either Go or Rust, depending on the project.

That said, while I LOVE working with Rust, it suffers from many of the same issues I mentioned for C++ in my comment above when working in a mixed skillset team.

257m ,

I agree, unless you doing low level stuff where you need absolute control you should use a modern language with proper abstraction just to save time. Most use cases where they use C++ can be replaced with Rust or Go as they aren’t saddled with years tech debt and bloat due to having mantaining backwards compatibility.

CanadaPlus ,

So would there be a happy medium between C and C++? A C+, if you will.

dylanTheDeveloper ,
@dylanTheDeveloper@lemmy.world avatar

C-+

eerongal ,
@eerongal@ttrpg.network avatar

-0.5 + (float) C++

PutangInaMo ,

Rust

CanadaPlus ,

I’m going to go ahead and say that’s not really a superset of C. But, yes, that’s the way everything is going in practice.

PutangInaMo ,

No not literally but you got it lol

zaphod ,

Yes, use C++, but with extern “C” for everything so you can easily interface with other software. That limits you to no classes or namespaces, but internally you can use smart pointers, vectors, maps and actual strings.

sirdorius ,

There is actually a C+, also called “orthodox” C++ gist.github.com/bkaradzic/2e39896bc7d8c34e042b

CanadaPlus ,

Thanks! I figured someone must have tried it.

palordrolap ,

Caution: Finding something that one hates more than one's self does not take away the initial self loathing. Attempting to mollify or subdue the lesser by observation or interaction with the latter may result in something greater than the sum of its parts and oh boy, Jeffery Christmas, now we're in for a bad time.

AstroTechie ,

I guess that’s how Java was born.

some_designer_dude ,

Java was conjured, not born.

CeeBee ,

I really don’t understand the hate that Java gets. I would use Java any day over C# if given the chance

qevlarr ,
@qevlarr@lemmy.world avatar

C++ is fine. I’m fine. It’s all fiiiiine

Rooki ,
@Rooki@lemmy.world avatar

Boy oh boy, you gonna hate like a sith if you find out how sh*tty python is.

lud ,

Or bash.

So incredibly annoying too read.

Hazzia ,

I know that there are use cases for [ ] over [[ ]]. There have to be. Why in god’s name would [ ] exist if there wasn’t a reason to use it over [[ ]]? I’m obviously the one in the wrong by only ever using [[ ]], because [ ] would definitely be better in some type of situations that I’m just not seeing clearly. Right???

hisbaan ,

I believe the reason is that bash is backwards compatible with sh and sh only has [ ], not [[ ]]

Number358 ,

Solution: fuck backwards compatibility and use fish

Cysioland ,
@Cysioland@lemmygrad.ml avatar

Fish is starting to get more POSIX compliant as of late, the error redirect is no longer ^ /dev/null but 2>/dev/null

twelvefloatinghands ,
@twelvefloatinghands@lemmy.world avatar

Fish might be good for interactivity, but in terms of scripting, just go straight to python. It’s not worth it.

float ,

[ is a binary (sometimes a symlink) in /usr/bin. It’s /usr/bin/[ 🤓

AffineConnection ,

[[ is not a POSIX shell feature.

palordrolap ,

Perl calls to you. Admire its beauty.

seth ,

cries in hours spent trying to walk through pretty but obtuse JAPHs

palordrolap ,

Perl's unreasonable effectiveness for creating write-only code was part of the joke.

twelvefloatinghands ,
@twelvefloatinghands@lemmy.world avatar

So many footguns. Use python in place of bash.

Rooki ,
@Rooki@lemmy.world avatar

tbh i would rather use assembly than python.

herr ,

Absolutely wild take, the two are used in completely different contexts

Rooki ,
@Rooki@lemmy.world avatar

python if you want to f*ck every developer that comes after you and the other if want to make a small script yes. Still would choose bash tbh.

twelvefloatinghands ,
@twelvefloatinghands@lemmy.world avatar

Python has its flaws for sure (I’m getting pretty fed up with the lack of required type notation, myself), but my point here is that bash is even worse:

Rooki ,
@Rooki@lemmy.world avatar

Bash is still better than python - Change my mind

twelvefloatinghands ,
@twelvefloatinghands@lemmy.world avatar

Why tho

Rooki ,
@Rooki@lemmy.world avatar

Because f*ck python lol. Its just bad

twelvefloatinghands ,
@twelvefloatinghands@lemmy.world avatar

Throw me a bone here. Is there like an existing reasons it sucks or do you just hate snakes?

dylanTheDeveloper ,
@dylanTheDeveloper@lemmy.world avatar

Assembly is torture because it has too much math in it

Rooki ,
@Rooki@lemmy.world avatar

But its less math than python. You dont have to role the dice if the error message is logical or not

lud ,

Wouldn’t it make more sense to code in c++ or something and compile to assembly?

How much more efficient than a compiler are one really?

Rooki ,
@Rooki@lemmy.world avatar

Yeah even that i would do, rather to do anything in python ;D

CoderKat ,

Bash is so bad. I literally use it every day and have written many Bash scripts, yet I’m constantly having to search for how to do things in it because syntax is so bizarre and difficult to remember. Need to do a for loop over lines in a file? You can bet I’m googling the syntax for it. I have a general idea for what it looks like and know what to search for, but no way in hell can I write it correctly in the first few tries.

String manipulation is the absolute worst. Have fun getting to learn the unreadable syntax of most sed and awk programs (the only thing most people have memorized is find and replace). Stuff like “split a string of comma separated ints and add them up” are way harder in Bash than in Python, despite the fact I often need to do stuff like that in Bash. Well, in the terminal anyway. Sometimes I’ll just use Python, but Python’s weakness is executing programs and getting their output, which is nowhere near as convenient as it is in Bash.

Side note, isn’t it weird that for a language where flags like –foo bar are so commonly used, there’s no built in or standard tools for accessing flags?

herr ,

???

Rooki ,
@Rooki@lemmy.world avatar

You forgot your indentation and a third party docs is outdated. Now try and debug it with this error message:

Not enough value to unpack (expected 2, got 1) (not any stack trace btw) documentation was terrible. :D

herr ,

Huh? The Python Stacktrace is great. What kinda fucked up library were you using that it prints the error code instead of raising an exception?!

Also don’t think outdated library docs are a fault of Python 😅 In much the opposite way, I’ve found Python’s standard library to be really great, reducing the number of random third party libraries needed. (Looking at you, JavaScript)

Rooki ,
@Rooki@lemmy.world avatar

Stack trace is terrible bad. Js for the win.

the default library is still terribly documented. OF COURSE everything is stated there but after reading the bible 3 times through you still didnt understand anything third or first party libraries!.

In python you need weirdly random packages that are inbuild but you still have to import them WHY THO??? ( looking at you typings )

The funniest thing is that python does not have a switch case where i heard it the first time, i laughed and didnt took him serious but then after looking into it, A BASIC SWITCH CASE does not exist in python. LMAO

herr ,

Imagine getting hung up on something as trivial as a switch statement. Which is more poignant, I ask you?


<span style="color:#323232;">switch(var){
</span><span style="color:#323232;">   case 1: 
</span><span style="color:#323232;">      <code>;
</span><span style="color:#323232;">      break;
</span><span style="color:#323232;">   case 2: 
</span><span style="color:#323232;">      <code>;
</span><span style="color:#323232;">      break;
</span><span style="color:#323232;">   case 3: 
</span><span style="color:#323232;">      <code>;
</span><span style="color:#323232;">      break;
</span><span style="color:#323232;">   default:
</span><span style="color:#323232;">      <code>
</span><span style="color:#323232;">}
</span>

or


<span style="color:#323232;">if var == 1:
</span><span style="color:#323232;">   <code>
</span><span style="color:#323232;">elif var == 2:
</span><span style="color:#323232;">   <code>
</span><span style="color:#323232;">elif var== 3:
</span><span style="color:#323232;">   <code>
</span><span style="color:#323232;">else:
</span><span style="color:#323232;">    <code>
</span>

The performance difference is absolutely negligible, but now you’ve introduced a bunch of unnecessary indentation (for no benefit) that’s gonna get hard to read should you even add a little bit of additional logic, and a footgun with all the break; s.

And then in JS the syntax for the case-blocks isn’t even consistent with the rest of the language.</code></code></code></code></code></code></code></code>

Rooki ,
@Rooki@lemmy.world avatar

the switch case. F*ck python still

malijaffri ,

I’m sorry, but when was the last time you actually used Python? Python has had a switch … case …-like structure called match … case … since v3.10:

https://www.geeksforgeeks.org/python-match-case-statement/

As for having to import standard libraries, why should every single function of every single built-in library be included in every single Python program, much less in compiled executables? At that point, it just bloats up your file sizes and RAM usage.

ETA: You are literally the only person in this whole thread that has such a huge problem with Python. What did it ever do to you?

Rooki ,
@Rooki@lemmy.world avatar

Because probably you all never coded something really with python.

Mikurei ,

You forgot your indentation

Sounds like a problem for someone who is writing the code on a toilet paper or whiteboard. Most people have some sort of hackable editor/IDE that handles the indentation and code blocks.

obfuscated error messages

Just don’t use libraries which print or log exceptions without raising it :)

Rooki ,
@Rooki@lemmy.world avatar

AWS boto3, FastAPI and django. Good to know, that i shouldnt use them.

lord_ryvan ,

What don’t you like about Python?

Rooki ,
@Rooki@lemmy.world avatar

The syntax, the syntax-highlighting, venv creation and usage, having to import everything even inbuild types, have fun checking what a third party library has for functions and what they need :D Async is a hecking mess, documentation is another (bad) story.

tias ,

I’m sure the syntax highlighting is entirely dependent on what editor you use, and is not a property of the language itself.

Rooki ,
@Rooki@lemmy.world avatar

I used pycharm, vscode ( with some extensions ), text editor, notepad++, IDLE even Thonny on my raspberry PI. Still all of them was syntax highlighting or suggestion terrible. I never knew what the function of a third party or sometimes first party library wanted.

PutangInaMo ,

I’ll throw a real petty one out there… indentation.

______ ,

I love and hate C++ it’s my self abuse love language.

Love: wow I’d like to make a project that does Y in cpp. Abuse: actually working on it.

ghoscht ,

Come on. C++ isn’t thaaat bad. It’s actually kind of nice to use coming from C.

AccidentalLemming , (edited )

deleted_by_author

  • Loading...
  • skullgiver ,
    @skullgiver@popplesburger.hilciferous.nl avatar

    deleted_by_author

  • Loading...
  • twelvefloatinghands ,
    @twelvefloatinghands@lemmy.world avatar

    Is there a way to disable the old c++ features? Or some kind of linter that points them out and suggests the new ways?

    skullgiver ,
    @skullgiver@popplesburger.hilciferous.nl avatar

    deleted_by_author

  • Loading...
  • twelvefloatinghands ,
    @twelvefloatinghands@lemmy.world avatar

    Any suggestions for linter?

    peopleproblems ,

    It’s actually kind of nice coming from C.

    I’m reading this and all I can think is “yeah, I too would rather lose a limb than let a necrotic infection spread.”

    Kage520 ,

    C sucks to write and take care of memory, but it’s nice for super efficient code for use on smart watches. Samsung ditched it (tizen- native apps written in C) in favor of wearOS (java?), and their battery life is now less than half what it was.

    twelvefloatinghands ,
    @twelvefloatinghands@lemmy.world avatar

    Ruuuuuuust

    Rodeo ,

    All this talk of Rust I’m seeing makes me so sad Ada was never given a fair chance.

    twelvefloatinghands ,
    @twelvefloatinghands@lemmy.world avatar

    First time I’m hearing about it. Any fun gimmicks?

    Rodeo ,

    I haven’t used it in a while, so I don’t remember off the top of my head. I guess the main thing is the syntax is much more natural than C-likes. It can be wordy but the flip side is that it’s easier to read and decipher.

    I don’t really think it has a future though. It was released in the 80s and suffers the same constraints from backwards compatibility as any other old language. Also it was intended to run on everything, so they limited the character set, which resulta in round brackets being the only brackets there are, which can lead to ambiguous code where for example you’re not sure if you’re accessing an array or calling a function that has the same name.

    I really want a safe language that has actual nice syntax instead of some gibberish with lots of symbols, and Ada is the closest I’ve found, but she’s old and forgotten now.

    morrowind ,
    @morrowind@lemmy.ml avatar

    Holy hell Java on a Smartwatch?

    frozen ,
    @frozen@lemmy.frozeninferno.xyz avatar

    Holy hell Java on a Smartwatch?

    WearOS is based on Android, which uses Android Runtime (ART) as the application runtime. ART uses Java (or any other JVM-compatible language, such as Kotlin) as the development language, but compiles the app to native code when it’s installed on a client device.

    So… Kind of?

    CoderKat ,

    I hate writing code in either language. But at least what C has going for it is that it’s waaaay simpler than C++. Simple can be a really good thing. Sure, all those cool features can save you time, but they can also be gotchas that will cause bugs.

    Though it is a balancing act. Too simple and you’ll make mistakes due to how much you have to repeat yourself or using unsafe equivalents (like using preprocessor directives to mimic features that C++ natively supports).

    skullgiver ,
    @skullgiver@popplesburger.hilciferous.nl avatar

    deleted_by_author

  • Loading...
  • float ,

    It’s the amount of legacy it’s carrying on that drives me crazy. Many of the implicit default implementations are confusing. That’s where all these “rule of 3”, “rule of 7”, “rule of whatever” come from. The way arguments are passed into functions is another issue. From the call-side you (sometimes) cannot tell if you’ll end up with a moved value or a dangling reference. The compiler will not stop you from using it. Even if the compiler has something to tell you, it’ll do it on the most cryptic way possible. I’m grateful we have C++, it paid lots of my bills. But it’s also a pain in the ass.

    CoderKat ,

    The most recent C++ thing I worked on (not that recent, like 5 years or so ago) was a fairly new project and the people working on it were really passionate about C++. But it was C++ code that ran as a Python library and was using the official Python C bindings. Not sure why we didn’t use one of the unofficial C++ libraries, but the usage of that C library (and such a fundamental one) held things back. We wrote was was modern C++ (at the time), but big chunks would be a completely different style.

    qaz ,

    I used COBOL to write a small program, and it’s not so bad either. Bonus is that your standards are lowered so much that Java feels concise.

    PutangInaMo ,

    Laughs in ADA

    twelvefloatinghands ,
    @twelvefloatinghands@lemmy.world avatar

    C++ was necessary, and truly great compared to its predecessor. But the world has marched on. Rust is the current benchmark.

    Empyreus ,

    Depends on the use case, for HPC c++ is still the benchmark.

    kevincox ,
    @kevincox@lemmy.ml avatar

    Yeah, some of the world marches slower than other parts.

    Sonotsugipaa ,
    @Sonotsugipaa@lemmy.dbzer0.com avatar

    My hatred for myself is fully symbiotic with my intermittent appreciation of C++

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines