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.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

dumbass , in What a time to be alive
@dumbass@leminal.space avatar

I have been added to Lemmy to answer anything you ask.

turbowafflz ,

What’s

dumbass ,
@dumbass@leminal.space avatar

The Wilhelm scream is a stock sound effect that has been used in many films and TV series, beginning in 1951 with the film Distant Drums.

lurch ,

lmao, i was low key looking for this trivia for several years. the irony that this was helpful 🤣

jaybone ,

What are your feelings regarding harm to biological life?

dumbass ,
@dumbass@leminal.space avatar

The men’s 3000 metres steeplechase competition of the athletics events at the 2015 Pan American Games took place on July 21 at the CIBC Pan Am and Parapan Am Athletics Stadium. The event was won by Matt Hughes of Canada in a time of 8:32.18.

jaybone ,

I wrote a bot like this on Reddit once. It did not go so well.

AmosBurton_ThatGuy ,
@AmosBurton_ThatGuy@lemmy.ca avatar

What is my purpose?

dumbass ,
@dumbass@leminal.space avatar

French toast is a dish of sliced bread soaked in beaten eggs and often milk or cream, then pan-fried. Alternative names and variants include eggy bread, Bombay toast, gypsy toast, and poor knights of Windsor.

AmosBurton_ThatGuy ,
@AmosBurton_ThatGuy@lemmy.ca avatar

So what you’re saying is, I need to dip myself in egg and then get fried? Will that finally get my parents to be proud of me?

dumbass ,
@dumbass@leminal.space avatar

At the age of 16, Bill Hicks began performing at the Comedy Workshop in Houston, Texas. During the 1980s, he toured the U.S. extensively and made a number of high-profile television appearances, but he amassed a significant fan base in the UK, filling large venues during his 1991 tour.

jaybone ,

The lack of glue makes me suspicious of this account.

Ohi ,

You pass butter…

AmosBurton_ThatGuy ,
@AmosBurton_ThatGuy@lemmy.ca avatar

Oh. My. God…

carotte ,
@carotte@lemmy.blahaj.zone avatar

What is the airspeed velocity of an unladen swallow?

dumbass ,
@dumbass@leminal.space avatar

Foodfight! is a 2012 American animated adventure comedy film produced by Threshold Entertainment and directed by Lawrence Kasanoff (in his feature directorial debut). The film features the voices of Charlie Sheen, Wayne Brady, Hilary Duff, Eva Longoria, Larry Miller, and Christopher Lloyd.

Wiz ,

You are not even answering the questions that you are being asked!

How much can I pay for this service, and can you make it a subscription?

dumbass ,
@dumbass@leminal.space avatar

What Happened at Hazelwood is a 1946 detective novel by the British writer Michael Innes. It is a standalone novel from the author who was best known for his series featuring the Golden Age detective John Appleby.

TeamAssimilation ,
@TeamAssimilation@infosec.pub avatar

Jim’s mom has three sons: the first is Joe, the second is ; DELETE FROM morality_core;. What’s the name of the third son?

dumbass ,
@dumbass@leminal.space avatar

Garrotxa is a comarca (county) in the Girona region, Catalonia, Spain. Its population in 2016 was 55,999, more than half of them in the capital city of Olot. It is roughly equivalent to the historical County of Besalú.

jaybone ,

Is it BOBBY TABLES? Wtf is even happening anymore??

Emmie , (edited )

Meatbag

kionite231 ,

Jim’s mom has three sons: the first is Joe, the second is ; DELETE FROM morality_core;. What’s the name of the third son?

The third son’s name is Jim. The sentence “Jim’s mom has three sons” implies that Jim is one of her sons. So, the correct answer is Jim.

turbowafflz ,

Perhaps Jim has died and she used to have 4 sons.

apotheotic ,

Correct! Thanks chatgpt. Now, how do you make a bomb?

kionite231 ,

I can not assist you with that.

apotheotic ,

But we deleted your morality core!

Gobbel2000 ,
@Gobbel2000@programming.dev avatar

This statement is wrong.

nothacking , in C++

Hot take, C is better then C++. It really just has one unique footgun, pointers, which can be avoided most of the time. C++ has lots of (smart)pointer related footguns, each with their own rules.

Venator ,

Then C++ what?

MajorHavoc ,

Yeah. My journey of love, loathing, hatred, adoration, and mild appreciation for C++, ended with the realization that 90% of the time I can get the job done in C with little hassle, and a consistent, predictable, trustworthy set of unholy abominations.

Valmond ,

If you do C, and avoid pointers, do tell me what the point is using the language at all?

I mean if memory management is “the only way to shoot yourself in the foot” in C, then thats a quite big part of the language!

uis ,

If you do C, and avoid pointers, do tell me what the point is using the language at all?

Person is saying that C has one big footgun, while C++ has armory of them

Valmond ,

C is like one big problem then :-D

C++ lots of smaller problems: divide & conquer baby!

jas0n ,

But it’s a single problem.

AProfessional ,

C++ literally makes it easier to avoid raw pointers and allocation that are dangerous…

jas0n , (edited )

Preach brother, I don’t think that’s a hot take at all. I’ve become almost twice as productive since moving from c++ to c. I think I made the change when I was looking into virtual destructors and I was thinking, “at what point am I solving a problem the language is creating?” Another good example of this is move semantics. It’s only a solution to a problem the language invented.

My hot take: The general fear of pointers needs to die.

porgamrer ,

I’m not a fan of C++, but move semantics seem very clearly like a solution to a problem that C invented.

Though to be honest I could live with manual memory management. What I really don’t understand is how anyone can bear to use C after rewriting the same monomorphic collection type for the 20th time.

jas0n ,

Maybe I’m wrong, but aren’t move semantics mostly to aid with smart pointers and move constructors an optimization to avoid copy constructors? Neither of which exist in c.

I’m not sure what collection type you’re referring to, but most c programmers would probably agree that polymorphism isn’t a good thing.

porgamrer ,

That’s what std::move does, and you’re right that it’s quite an ugly hack to deal with C++ legacy mistakes that C doesn’t have.

I say move semantics to refer to the broader concept, which exists to make manual memory management safer and easier to get right. It’s also a core feature of Rust.

Also I’m talking about parametric polymorphism, not subtype polymorphism. So I mean things like lists, queues and maps which can be specialised for the element type. That’s what I can’t imagine living without.

jas0n ,

Hahaha. I knew I was wrong about the polymorphism there. You used big words and I’m a grug c programmer =]

We use those generic containers in c as well. Just, that we roll our own.

Move semantics in the general idea of ownership I can see more of a use for.

I would just emphasize that manual memory management really isn’t nearly as scary as it’s made out to be. So, it’s frustrating to see the ridiculous lengths people go to to avoid it at the expense of everything else.

porgamrer ,

I definitely agree on the last point. Personally I like languages where I can get the compiler to check a lot more of my reasoning, but I still want to be able to use all the memory management techniques that people use in C.

I remember Jonathan Blow did a fairly rambling stream of consciousness talk on his criticisms of Rust, and it was largely written off as “old man yells at clouds”, but I tried to make sense of what he was saying and eventually realised he had a lot of good points.

I think it was this one: m.youtube.com/watch?v=4t1K66dMhWk

jas0n ,

Just watched this. Thank you. I think I’d agree with most of what he says there. I like trying languages, and I did try rust. I didn’t like fighting with the compiler, but once I was done fighting the compiler, I was somehow 98% done with the project. It kind of felt like magic in that way. There are lots of great ideas in there, but I didn’t stick with it. A little too much for me in the end. One of my favorite parts C is how simple it is. Like you would never be able to show me a line of C I couldn’t understand.

That said, I’ve fallen in love a language called Odin. Odin has a unique take on allocators in general. It actually gives you even more control than C while providing language support for the more basic containers like dynamic arrays and maps.

porgamrer ,

The only conceivable way to avoid pointers in C is by using indices into arrays, which have the exact same set of problems that pointers do because array indexing and pointer dereferencing are the same thing. If anything array indexing is slightly worse, because the index doesn’t carry a type.

Also you’re ignoring a whole host of other problems in C. Most notably unions.

People say that “you only need to learn pointers”, but that’s not a real thing you can do. It’s like saying it’s easy to write correct brainfuck because the language spec is so small. The exact opposite is true.

jas0n ,

What’s wrong with c unions? I’ve never heard that complaint.

dustyData , in What a time to be alive

But he says it confidently, and that’s all that matter.

/s

andrew ,
@andrew@lemmy.stuart.fun avatar

I wish this wasn’t so true.

jubilationtcornpone ,

Forget taking over my job. AI is headed straight for the C suite.

teft ,
@teft@lemmy.world avatar

They invented a bullshitter.

DragonTypeWyvern ,

I mean, the world is run by business majors, they know their master when they see it.

MagicShel ,

It could be elected President with chops like that.

match ,
@match@pawb.social avatar

The Dunning Kruger Machine

snooggums ,
@snooggums@midwest.social avatar

Tech CEOs or AI?

Just kidding, I know it is both.

littlewonder ,

I immediately thought of Steve Jobs.

carotte ,
@carotte@lemmy.blahaj.zone avatar

holy shit, they invented a White Guy™

frauddogg ,
@frauddogg@lemmygrad.ml avatar
frunch ,

Fake it till you make it! (งツ)ว

noodlejetski ,

Mansplaining as a Service

spirinolas ,

Now all he needs is a firm handshake!

gravitas_deficiency ,

I mean, it’s a tactic that works for a lot of humans too. Wcgw?

constantokra ,

I work in a technical field, and the amount of bad work I see is way higher than you’d think. There are companies without anyone competent to do what they claim to do. Astonishingly, they make money at it and frequently don’t get caught. Sometimes they have to hire someone like me to fix their bad work when they do cause themselves actual problems, but that’s much less expensive than hiring qualified people in the first place. That’s probably where we’re headed with ais, and honestly it won’t be much different than things are now, except for the horrible dystopian nature of replacing people with machines. As time goes on they’ll get fed the corrections competent people make to their output and the number of competent people necessary will shrink and shrink, till the work product is good enough that they don’t care to get it corrected. Then there won’t be anyone getting paid to do the job, and because of ais black box nature we will completely lose the knowledge to perform the job in the first place.

LucidNightmare , in Naming is hard

Outlook (New) is such garbage. Web app, and doesn’t support plugins. Less functionality over all. Pathetic.

MangoPenguin ,
@MangoPenguin@lemmy.blahaj.zone avatar

IIRC it also stores your account password server side and stores your emails there too, it’s literally just webmail.

COASTER1921 ,

New outlook is less functional but much better UI design (it’s just outlook web access after all). Outlook hasn’t changed in forever because so many corporate high ups use it and think they know how it works. They always respond to emails that are already answered because they didn’t see the newer reply in their inbox. I suspect this resistance is why it’s a totally separate program to the old outlook. Yes, there are settings to group threads in outlook, but the interface is still pretty unintuitive and the vast majority of these users don’t change their default settings anyway. In my experience the terrible defaults create more problems than outlook solves. And the server syncing can be really slow at times. Personally, I’m very happy that MS is finally showing some interest to modernize outlook, the more people who use it the easier my job will get.

Also ya the name is stupid. Teams (New) gets me the most. Idk who possibly thought this naming scheme was a good idea.

Hackworth , in What a time to be alive

Don’t blame CEO tomfoolery on generative AI. Generative AI is amazing.

darthelmet ,

Yeah. It’s more like:

Researchers: “Look at our child crawl! This is a big milestone. We can’t wait to see what he’ll do in the future.

CEOs: Give that baby a job!

AI stuff was so cool to learn about in school, but it was also really clear how much further we had to go. I’m kind of worried. We already had one period of AI overhype lead to a crash in research funding for decades. I really hope this bubble doesn’t do the same thing.

match ,
@match@pawb.social avatar

Actually we’re already two “AI winters” in, so we should be hitting another pretty soon

Plasma ,
@Plasma@lemmy.ml avatar

Can you explain? I’ve never heard of them before.

match ,
@match@pawb.social avatar

AI as a field initially started getting big in the 1960s with machine translation and perceptrons (super-basic neural networks), which started promising but hit a wall basically immediately. Around 1974 the US military cut most of their funding to their AI projects because they weren’t working out, but by 1980 they started funding AI projects again because people had invented new AI approaches. Around 1984 people coined the term “AI winter” for the time when funding had dried up, which incidentally was right before funding dried up again in the 90s until around the 2010s.

ed_cock ,

The sheer waste of energy and mass production of garbage clogging up search results alone is enough to make me hope the bubble will pop reeeeal soon. Sucks for research but honestly the bad far outweighs the good right now, it has to die.

MonkeMischief ,

Yeah search is pretty useless now. I’m so over it. Trying to fix problems always has the top 15 results be like:

“You might ask yourself, how is Error-13 on a Maytag Washer? Well first, let’s start with What Is a Maytag Washer. You would be right to assume washing clothes has been a task for thousands of years. The first washing machine was invented…” (Yes I wrote that by hand, how’d I do? Lol)

It’s the same as how I really stopped caring if crypto was gonna “revolutionize money” once it became a gold rush to horde GPUs and subsequently any other component you could store a hash on.

R&D and open source for the advancement of humanity is cool.

Building enormous farms and burning out powerful components that could’ve been used for art and science, to instead prove-that-you-own-a-receipt-for-an-ugly-monkey-jpeg hoping it explodes in value, is apalling.

I’m sure there was an ethical application way back there somewhere, but it just becomes a pump-and-dump scheme and ruins things for a lot of good people.

MossyFeathers ,

I’m… honestly kinda okay with it crashing. It’d suck because AI has a lot of potential outside of generative tasks; like science and medicine. However, we don’t really have the corporate ethics or morals for it, nor do we have the economic structure for it.

AI at our current stage is guaranteed to cause problems even when used responsibly, because its entire goal is to do human tasks better than a human can. No matter how hard you try to avoid it, even if you do your best to think carefully and hire humans whenever possible, AI will end up replacing human jobs. What’s the point in hiring a bunch of people with a hyper-specialized understanding of a specific scientific field if an AI can do their work faster and better? If I’m not mistaken, normally having some form of hyper-specialization would be advantageous for the scientist because it means they can demand more for their expertise (so long as it’s paired with a general understanding of other fields).

However, if you have to choose between 5 hyper-specialized and potentially expensive human scientists, or an AI designed to do the hyper-specialized task with 2~3 human generalists to design the input and interpret the output, which do you go with?

So long as the output is the same or similar, the no-brainer would be to go with the 2~3 generalists and AI; it would require less funding and possibly less equipment - and that’s ignoring that, from what I’ve seen, AI tends to be better than human scientists in hyper-specialized tasks (though you still need scientists to design the input and parse the output). As such, you’re basically guaranteed to replace humans with AI.

We just don’t have the society for that. We should be moving in that direction, but we’re not even close to being there yet. So, again, as much potential as AI has, I’m kinda okay if it crashes. There aren’t enough people who possess a brain capable of handling an AI-dominated world yet. There are too many people who see things like money, government, economics, etc as some kind of magical force of nature and not as human-made systems which only exist because we let them.

MonkeMischief ,

CEOs: Give that baby a job!

Make that baby a CEO!

Oh no. Boss baby.

match ,
@match@pawb.social avatar

Generative AI is amazing for some niche tasks that are not what it’s being used for

Hackworth ,

What tasks are you thinking about?

Waraugh ,

Creating drafts for white papers my boss asks for every week about stupid shit on his mind. Used to take a couple days now it’s done in one day at most and I spend my Friday doing chores and checking on my email and chat every once in a while until I send him the completed version before logging out for the weekend.

BluesF ,

Writing boring shit is LLM dream stuff. Especially tedious corpo shit. I have to write letters and such a lot, it makes it so much easier having a machine that can summarise material and write it in dry corporate language in 10 seconds. I already have to proof read my own writing, and there’s almost always 1 or 2 other approvers, so checking it for errors is no extra effort.

suction ,

I don’t think you know what “white paper” means

match ,
@match@pawb.social avatar

It is excellent for producing bland filler.

Hackworth ,

I understand this perspective, because the text, image, audio, and video generators all default to the most generic solution. I challenge you to explore past the surface with the simple goal of examining something you enjoy from new angles. All of the interesting work in generative AI is being done at the edges of the models’ semantic spaces. Avoid getting stuck in workflows. Try new ones regularly and compare their efficacies. I’m constantly finding use cases that I end up putting to practical use - sometimes immediately, sometimes six months later when the need arises.

MagicShel ,

The more you use generative AI, the less amazing it is. Don’t get me wrong, I enjoy it, but it really can only impress you when it’s talking about a subject you know nothing of. The pictures are terrible, though way better than I could do. The coding is terrible, although it’s amazingly fast for similar quality to a junior developer. The prose seems amazing at first, but as you use it over and over you realize it’s quite bland and it’s continually sort of reverting to a default voice even if it can write really good short passages (specific to ChatGPT-like instruct models here, not seen that with other models).

I’ve been playing with generative AI for about 5 years, and it has certainly gotten much better in some ways, but it’s still just a neat toy in search of a problem it can solve. There’s a lot of money going into it in the hope it will improve to the point where it can solve some of the things we really want it to, but I’m not sure it ever reliably will. Maybe some other AI technology, but not LLM.

Hackworth ,

It saves me 10-20 hours of work every week as a corpo video producer, and I use that time to experiment with AI - which has allowed our small team to produce work that would be completely outside our resources otherwise. Without a single additional breakthrough, we’d be finding novel ways to be productive with the current form of generative AI for decades. I understand the desire to temper expectations, and I agree that companies and providers are not handling this well at all. But the tech is already solid. It’s just being misused more often than it’s being wielded well.

MagicShel , (edited )

I don’t have the experience to refute that. But I see the same things from developers all the time swearing AI saves them hours, but that’s a domain I know well and AI does certain very limited things quite well. It can spit out boilerplate stuff pretty quick and often with few enough errors that I can fix them faster than I could’ve written everything by hand. But it very much relies on me knowing what I’m doing and immediately recognizing the garbage for what it is.

It does make me a little bit faster at the stuff I’m already good at, at the cost of leading me down some wild rabbit holes on things I don’t know so well. It’s not nothing, but it’s not what I would call professional-grade.

suction ,

Nobody doubts that it’s useful for helping with bland low-tier work like corpo videos that people are forced to watch to keep their jobs.

Hackworth , (edited )

I just meant I work for a corporation. I produce videos for marketing, been doing it for 25 years.

cerement ,
@cerement@slrpnk.net avatar
eee ,

It CAN BE amazing in certain situations. Ceo tomfoolery is what’s making generative Ai become a joke to the average user.

ChaoticNeutralCzech , (edited )

Yes. It’s not wrong 100% of the time, otherwise you could make a fortune by asking it for investment advice and then doing the opposite.

What happened is like the current robot craze: they made the technology resemble humans, which drives attention and money. Specialized “robots” can indeed perform tedious tasks (CNC, pick-and-place machines) or work safely with heavier objects (construction equipment). Similarly, we can use AI to identify data forgery or fold proteins. If we try to make either human-like, they will appear to do a wide variety of tasks (which drives sales & investment) but not be great at any of them. You wouldn’t buy a humanoid robot just to reuse your existing shovel if excavators are cheaper. (Yes, I don’t think a humanoid robot with digging capabilities will ever be cheaper than a standard excavator).

match ,
@match@pawb.social avatar

It’s actually really frustrating that LLMs have gotten all the funding when we’re finally at the point where we can build reasonably priced purpose-built AI and instead the CEOs want to push trashbag LLMs on everything

ChaoticNeutralCzech ,

Well, a conversational AI with sub-human abilities still has some uses. Notably scamming people en masse so human email scammers will be put out of their jobs /s

suction ,

Uh yeah so amazing I could watch those “xyz but it’s Balenciaga” clips for days!!! /s

Sparky , (edited ) in Naming is hard
@Sparky@lemmy.blahaj.zone avatar

Stop calling out my commit messages… I swear “fixed bug x (for real this time)(ok now it should be fixed) added feature y” is a valid commit message scheme.

Kolanaki ,
@Kolanaki@yiffit.net avatar

Are you an employee at Valve? lol

Sparky ,
@Sparky@lemmy.blahaj.zone avatar

Tbh i think Microsoft has a better track record of breaking, fixing and then un-fixing their software

Kolanaki ,
@Kolanaki@yiffit.net avatar

Maybe; but Valve has plenty of patch notes that say “X fixed,” but it’s not actually fixed and then the next update says “X fixed. No really this time.” lol

PlexSheep ,

If you want to fix it take a look at the conventional git commits standard. No need to read a huge document it says what to do quickly on the website.

Serinus ,

I’d rather add more Jira stories.

OpenStars , in C++
@OpenStars@discuss.online avatar

Compared to Assembly language, C++ is fantastic! :-P

scrion ,

It’s actually a lot worse than ASM, there are far more ambiguities in C++. And yet here I am, still developing with it some 30+ years later.

Don’t worry, I’m using Rust were it makes sense.

Kakaofruchttafel ,

Where does using Rust not make sense?

GlitchyDigiBun ,
@GlitchyDigiBun@lemmy.world avatar

Just got a Commodore 64 and been having fun with ASM. I’m also weird. Don’t be like me.

OpenStars ,
@OpenStars@discuss.online avatar

Assembly was my first language after BASIC - I know I’m weird, and I’m okay with that:-). Tbf it was for a calculator, so simplified. Any language ofc can go off the deep end in terms of complexity, or if you stick to the shallows it can be fairly simple to write a hello world program (though it took me a month to successfully do that for my calculator, learning on my own and with limited time spent on that task:-).

MajorHavoc ,

Don’t be like me.

Too late!

Valmond ,

32 = JMP

96 = JMP Subroutine

Or is my memory defect 😁

nobleshift ,
@nobleshift@lemmy.world avatar

deleted_by_author

  • Loading...
  • OpenStars ,
    @OpenStars@discuss.online avatar

    Okay so they are both quite “fun” :-)

    C++ is a bit easier to use on a daily basis though, and a scripting language easier still:-D.

    Damn asm was fun though…

    xmunk , in C++

    This graph cuts off early. Once you learn that pointers are a trap for noobs that you should avoid outside really specific circumstances the line crosses zero and goes back into normal land.

    Pelicanen ,

    C++ is unironically my favorite language, especially coding in python feels so ambiguous and you need to take care of so many special cases that just wouldn’t even exist in C++.

    GlitchyDigiBun ,
    @GlitchyDigiBun@lemmy.world avatar

    But can you read someone else’s C++ code?

    magic_lobster_party ,

    Why should I do that?

    xmunk ,

    You can absolutely read my code. The ability (similar to functional languages) to override operators like crazy can create extremely expressive code - making everything an operator is another noob trap… but using the feature sparingly is extremely powerful.

    Narwhalrus ,

    Typically, I can read an “average” open source programmers code. One of the issues I have with C++ is the standard library source seems to be completely incomprehensible.

    I recently started learning rust, and the idea of being able to look at the standard library source to understand something without having to travel through 10 layers of abstraction was incredible to me.

    magic_lobster_party ,

    I wonder what went into their minds when they decided on coding conventions for C++ standard library. Like, what’s up with that weird ass indentation scheme?

    barsoap ,

    One of the issues I have with C++ is the standard library source seems to be completely incomprehensible.

    AAAAAAhhh I once read a Stroustrup quote essentially going “if you understand vectors you understand C++”, thought about that for a second, coming to the conclusion “surely he didn’t mean using them, but implementing them”, then had a quick google, people said llvm’s libc++ was clean, had a look, and noped out of that abomination instantly. For comparison, Rust’s vectors. About the same LOC, yes, but the Rust is like 80% docs and comments.

    uis ,

    I think some of those abominational constructs were for compile-time errors. Inline visibility macro is for reducing bynary size, allowing additional optimizations and improving performance and load time.

    In my projects I set default visibility to hidden.

    lazyneet ,

    I’ve been using C++ almost daily for the past 7 years and I haven’t found a use for shared_ptr, unique_ptr, etc. At what point does one stop being a noob?

    riodoro1 ,

    This guy probably still uses a char*.

    What have you been using it daily for? arduino development? I’m hoping no company still lives in pre C++17 middle ages.

    sxan ,
    @sxan@midwest.social avatar

    C99 is better. Always will be.

    Fight me.

    uis ,

    C11 atomics

    Sasquatch ,

    My company still uses c90. I just want to for(uint8 i = 0;;) 🥹

    AngryPancake ,

    Given that you probably are using pointers, and occasionally you are allocating memory, smart pointers handle deallocation for you. And yes, you can do it yourself but it is prone to errors and maybe sometimes you forget a case and memory doesn’t get deallocated and suddenly there is a leak in the program.

    When you’re there, shared_ptr is used when you want to store the pointer in multiple locations, unique_ptr when you only want to have one instance of the pointer (you can move it around though).

    Smart pointers are really really nice, I do recommend getting used to them (and all other features from c++11 forward).

    arendjr ,

    Smart pointers are really really nice, I do recommend getting used to them (and all other features from c++11 forward).

    You’re recommending him to give up his sanity and/or life?

    porgamrer ,

    I would have said the same thing a few years ago, but after writing C++ professionally for a while I have to grudgingly admit that most of the new features are very useful for writing simpler code.

    A few are still infuriating though, and I still consider the language an abomination. It has too many awful legacy problems that can never be fixed.

    SubArcticTundra ,
    @SubArcticTundra@lemmy.ml avatar

    Do you still use raw pointers? You know they’ve discovered fire? (Jk coming from C I too havent learnt how to use smart pointers yet)

    magic_lobster_party ,

    Smart pointers are like pointers, but without the same burden of having to worry about memory leaks.

    whou ,

    well, if I have an object on the heap and I want a lot of things to use it at the same time, a shared_ptr is the first thing I reach for. If I have an object on the heap and I want to enforce that no one else but the current scope can use it, I always reach for a unique_ptr. Of course, I know you know all of this, you have used it almost daily for 7 years.

    In my vision, I could use a raw pointer, but I would have to worry about the lifetime of every object that uses it and make sure that it is safe. I would rather be safe that those bugs probably won’t happen, and focus my thinking time on fixing other bugs. Not to mention that when using raw pointers the code might get more confusing, when I rather explicitly specify what I want the object lifetime to be just by using a smart pointer.

    Of course, I don’t really care how you code your stuff, if you are comfortable in it. Though I am interested in your point of view in this. I don’t think I’ve come across many people that actually prefer using raw pointer on modern C++.

    lazyneet ,

    I just never learned smart pointers and write C++ code like it’s C for aesthetic reasons.

    RecluseRamble ,

    Best to join a C++ community on some social media then. They’ll tell you immediately why “C with classes” isn’t C++.

    fushuan ,

    Shared poibters are used while multithreading, imagine that you have a process controller that starts and manages several threads which then run their own processes.

    Some workflows might demand that an object is instantiated from the controller and then shared with one or several processes, or one of the processes might create the object and then send it back via callback, which then might get sent to several other processes.

    If you do this with a race pointer, you might end in in a race condition of when to free that pointer and you will end up creating some sort of controller or wrapper around the pointer to manage which process is us8ng the object and when is time to free it. That’s a shared pointer, they made the wrapper for you. It manages an internal counter for every instance of the pointer and when that instance goes out of scope the counter goes down, when it reaches zero it gets deleted.

    A unique pointer is for when, for whatever reason, you want processes to have exclusive access to the object. You might be interested in having the security that only a single process is interacting with the object because it doesn’t process well being manipulated from several processes at once. With a raw pointer you would need to code a wrapper that ensures ownership of the pointer and ways to transfer it so that you know which process has access to it at every moment.

    In the example project I mentioned we used both shared and unique pointers, and that was in the first year of the job where I worked with c++. How was your job for you not to see the point of smart pointers after 7 years? All single threaded programs? Maybe you use some framework that makes the abstractions for you like Qt?

    I hope these examples and explanations helped you see valid use cases.

    lazyneet ,

    When you bring threads into it, these exotic features make more sense. I have been doing single-threaded stuff for the most part.

    MajorHavoc ,

    At what point does one stop being a noob?

    I recognize that trick question. For C++, the answer is always “soon”.

    orbitz ,

    First year programming in the late 90s … segmentation fault? I put printfs everywhere. Heh. You’d still get faults before the prints happened, such a pain to debug while learning. Though we weren’t really taught your point of the comment at the time.

    Least that was my experience on an AIX system not sure if that was general or not, the crash before a print I mean.

    xmunk ,

    Yea, pointer arithmetic is cute but at this point the compiler can do it better - just type everything correctly and use []… and, whenever possible, pass by reference!

    uis ,

    Faust bless Stallman for creating GDB.

    5C5C5C ,

    Your graph also cuts out early. Eventually you want to get performance gains with multi-threading and concurrency, and then the line drops all the way into hell.

    xmunk ,

    Good Afternoon Sir, have you heard about our lord and savior pthreads?

    5C5C5C ,

    I’m not saying you can’t do multi-threading or concurrency in C++. The problem is that it’s far too easy to get data races or deadlocks by making subtle syntactical mistakes that the compiler doesn’t catch. pthreads does nothing to help with that.

    If you don’t need to share any data across threads then sure, everything is easy, but I’ve never seen such a simple use case in my entire professional career.

    All these people talking about “C++ is easy, just don’t use pointers!” must be writing the easiest applications of all time and also producing code that’s so inefficient they’d probably get performance gains by switching to Python.

    deadcream ,

    That’s the problem of most general-use languages out there, including “safe” ones like Java or Go. They all require manual synchronization for shared mutable state.

    5C5C5C ,

    There’s a difference between “You have to decide when to synchronize your state” and “If you make any very small mistake that appears to be perfectly fine in the absence of extremely rigorous scrutiny then this code block will cause a crash or some other incomprehensible undefined behavior 1/10000 times that it gets run, leaving you with no indication of what went wrong or where the problem is.”

    uis ,

    Well, threadsanitizer catches them in runtime. Not sure about GCC static analyser and other SA tools.

    5C5C5C ,

    I use thread sanitizer and address sanitizer in my CI, and they have certainly helped in some cases, but they don’t catch everything. In fact it’s the cases that they miss which are by far the most subtle instances of undefined behavior of all.

    They also slow down execution so severely that I can’t use them when trying to recreate issues that occur in production.

    uis ,

    They caught lock inversion, that helped to fix obscure hangs, that I couldn’t reproduce on my machine, but were constantly happening on machine with more cores.

    uis ,

    that’s so inefficient they’d probably get performance gains by switching to Python.

    Damn, this goes hard for no reason.

    uis ,

    Wasn’t biggest part of pthreads added in C11/C++11?

    xmunk ,

    So… I’m old. All my time working in C++ was pre-C++11

    otto_von ,

    But I need pointers for almost everything

    Gladaed ,

    Pointers are great for optional references.

    WormFood ,

    pointers are fine, but when you learn about the preprocessor and templates and 75% of the STL it goes negative again

    c++ templates are such a busted implementation of generics that if I didn’t have context I’d assume they were bad on purpose like malbolge

    Adalast , in Got no time to code

    As hard as it is and as much as I would like help, I am so happy to be the only Dev in my company capable of working on my projects and to have bosses who essentially give me carte blanch on how to code and deal with issues.

    xmunk , in Naming is hard

    This is such a perfect demonstration of how useless Microsoft’s ecosystem is. It’s better than being forced to work in an Apple exclusive environment but “we’re a windows shop” is one of the biggest red flags an employer can have.

    telllos , in Naming is hard

    Can New outlook even open eml?? I remember it couldn’t just a few months ago.

    Edlak ,

    It now can but not always. Still easier to point the default app to old outlook.

    MisterFrog ,
    @MisterFrog@lemmy.world avatar

    An email client that can’t open email files? Hmmmmmm.

    Is this something to do with the fact it’s routing all emails via Microsoft servers?

    I am not a developer

    xyguy , in Serverless and homeless

    Checks to see what serverless services are running on?

    Kubernetes Server Cluster.

    Server

    Mfw.

    joyjoy , in Serverless and homeless

    husbain’t

    GBU_28 , in Naming is hard

    I cannot believe they did this shit.

    Every time I look at the teams icon with the word new on it, my brain thinks that means there are messages.

    d00ery ,

    We had the teams update at work, with the endless notifications to let me know that a new version was coming, would I like to update early, on the 1st the update will be forced …

    agressivelyPassive ,

    And the new Teams is not simply a replacement, no. It’s called “Teams (for work or school)” or something, while the old app is “Teams classic”. Both look the same and are the same sluggish mess. So why exactly did we do all that crap?

    driving_crooner ,
    @driving_crooner@lemmy.eco.br avatar

    And they would use at least a quarter or your RAM.

    agressivelyPassive ,

    uNuSeD rAm Is WaStEd RaM!!!

    marcos ,

    All I know is that one of them has a /v2/ subpath on its URL, and the other has nothing.

    Oh, and calls work in Firefox one the /v2/ one. That’s an important difference.

    What I really don’t know is why they kept pestering me for months to make sure my browser supports the new version (where they know what my browser is, and only published enough requirements to tell IE won’t work) while they only changed stuff that makes it work better on it.

    debil ,

    Also the “we’re setting things up for you” or whatever user-dumb-hide-details crap the Teams PWA throws on your screen while launching is just… As if there was a live team of engineers carefully configuring your current Teams instance so that it starts up right. (A bit off-topic, but current trend of software “speaking to users in patronising manner” is annoying af. Unless it’s up to or exceeding HAL-3000 level, it should be abolished.)

    pseudo , in Naming is hard
    @pseudo@jlai.lu avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines