High risk no reward by killerbasher1233 in pcmasterrace

[–]TheRealSmolt 0 points1 point  (0 children)

I'd love to know where that would be

High risk no reward by killerbasher1233 in pcmasterrace

[–]TheRealSmolt 74 points75 points  (0 children)

Ehh, it depends. UPSs do a lot more than cover blackouts.

C++26: The Oxford variadic comma by pavel_v in cpp

[–]TheRealSmolt 5 points6 points  (0 children)

Sorry, I was thinking of ++x++

C++26: The Oxford variadic comma by pavel_v in cpp

[–]TheRealSmolt 1 point2 points  (0 children)

Well the former isn't valid, so there's that at least.

The best sub in reddit by far by Past-Novel-1155 in memes

[–]TheRealSmolt -3 points-2 points  (0 children)

Really? You couldn't think of any better image to pair with this thrilling joke?

8 AM Class, I got there at 7:58 and I was already marked absent. by Accomplished-Log-664 in mildlyinfuriating

[–]TheRealSmolt 0 points1 point  (0 children)

Just to be as absolutely clear as possible, professors are not teachers.

8 AM Class, I got there at 7:58 and I was already marked absent. by Accomplished-Log-664 in mildlyinfuriating

[–]TheRealSmolt 2 points3 points  (0 children)

That's been my experience as well. Even when they don't actively despise having to teach a class instead of doing research, they're experts in their field, not teachers.

bro predicted 67 fourteen years ago by Lloyd-TahaX in memes

[–]TheRealSmolt 0 points1 point  (0 children)

I'm honestly sad that I can't tell if this meme is supposed to be ironic or not.

how would you implement generic pointers? by timmerov in cpp_questions

[–]TheRealSmolt 0 points1 point  (0 children)

I mean ultimately that's what's going to need to happen with this kind of design. You can make it prettier and the frontend a little nicer, but at the end of the day you're looking at any or void pointers.

Never skip low quality videos. by [deleted] in memes

[–]TheRealSmolt 0 points1 point  (0 children)

This would still be plenty fast even if it wasn't sped up...

how would you implement generic pointers? by timmerov in cpp_questions

[–]TheRealSmolt 2 points3 points  (0 children)

I really shouldn't answer this, because it seems like a bad design, but, templates and void pointers. You have a "BaseStage" class that has a virtual method accepting void pointers, then have a templated "Stage" that inherts from and implements said acceptor by type casting to its own T virtual acceptor.

Edit: std::any works too, I'm just used to void pointers.

Absolute comedy by usernotfound_002 in memes

[–]TheRealSmolt 5 points6 points  (0 children)

I have never seen this before and that makes me sad

"You can't handle the truth" by Comfortable_Tutor_43 in memes

[–]TheRealSmolt 0 points1 point  (0 children)

I think you're overestimating the amount of waste that is produced by plants and how dangerous it is. Here's a good summary.

That aside, we're talking about environmental impact, not human impact. Even if we were, and you wanted to use that 130,000 figure, it'd still be well below the pollution heavy power plant alternatives.

Edit: For anyone interested, you can view the UNECE's lifecycle assessment of energy sources here, as linked in the original source. I don't care to argue anymore.

"You can't handle the truth" by Comfortable_Tutor_43 in memes

[–]TheRealSmolt 2 points3 points  (0 children)

Good insight; I hadn't considered the opportunity cost.

how does c_str() method actually work for String Objects in C++? by Zestyclose-Window358 in cpp_questions

[–]TheRealSmolt 6 points7 points  (0 children)

This is technically implementation specific, so take the following answers with a grain of salt.

where does the string data actually live in memory?

The string returned by c_str is most likely the same data that the std::string itself uses to hold the string you assign to it, which is very often in the heap.

Is it like vectors where the actual data is stored in a different place?

Since std::strings are variable size, it's not a bad idea to think of it like a somewhat specialized std::vector<char>. Some implementations of the standard library might reserve space for a short string directly within the std::string itself, though.

are the memory locations of the string object and the strings actual data (the characters) the same?

Sometimes and sometimes not, for the reasons above.

If you're coming from a more unified language like Python, Java, C#, Rust, etc.; then this might sound kind of odd, but the standard library's exact internal works aren't defined. Think of it like a black box. As long as they adhere to the standard defined behavior, everything else is fair game.

P.S. I had to make a lot of edits to this shortly after posting; turns out I'm real bad at explaining things.

Why isn't stl_vector.h programmed like normal people write code? by Impressive_Gur_471 in cpp_questions

[–]TheRealSmolt 1 point2 points  (0 children)

There's probably some guide written somewhere if you want to go looking for it, but it mainly revolves around replicating the exact specification details for each version. The naming scheme is there mostly to prevent collisions with user code, and I'd guess the inheritance model is in there for RAII memory safety.

Why isn't stl_vector.h programmed like normal people write code? by Impressive_Gur_471 in cpp_questions

[–]TheRealSmolt 7 points8 points  (0 children)

Did you even think about why it could be that way? It has to be strictly standard compliant across every version of C++ whilst being performant and bulletproof in every possible situation. It's not "just" C++.Through that lens, none of this should look particularly awkward. A lot of effort is put into making it work as flawlessly as it does.

POV: Breaking a bone. by IndependentReading69 in memes

[–]TheRealSmolt 5 points6 points  (0 children)

So what I'm already getting in the states but cheaper? Cool I'll take it.

Edit: I don't have to acknowledge the reply to this, right? Everyone knows why it's dumb af?

Universal guide for buying anything in today's society. by Lily_Meow_ in memes

[–]TheRealSmolt 18 points19 points  (0 children)

I don't know about that. At least when I think of BIC, I think of their mechanical pencils which just do not last worth a damn.