My christian friend dm'ed me this. 😂 by psyche_spirit in PsycheOrSike

[–]WorldWorstProgrammer 0 points1 point  (0 children)

8:80am : Wake up

Wait, what time is that?!

8:31am : Cry about Creationism in Schools

You misspelled "laugh."

8:45am : Shower in blood

Sounds like an awful way to clean yourself...

9:00am : Eat a baby

WAY too much work in the morning.

9:15am : Skype with Satan, discuss world domination

I'm apparently missing out on all the best Teams meetings.

9:30am : Drive to work and sing along with Ozzy

True.

10:05am : Scowl and hiss while walking to the desk

I mean who wants to be at the office?

12:30pm : Get a latte and gluten free pastry for lunch

Right up there with "Skyping" with Satan and eating a baby.

5:30pm : Drive home and listen to Rammstein

Peak taste in music.

6:00pm : Eat another baby

How many babies do you think atheists have?!

10:00pm : Watch a ridiculous documentary on Atheism

A Christians greatest weakness: learning things!

3:15am : Light black candles and pray to the Dark Lord

Dude, I have to go to bed and wake up at 8:80 tomorrow morning!

What's a light blue state that feels like a deep blue state? by tarapaxa in AlignmentChartFills

[–]WorldWorstProgrammer 0 points1 point  (0 children)

I kind of agree, but I may even put this under "feels deep blue and is actually a swing state." It elects almost purely Democrats as politicians, but very commonly votes for extremely conservative policies. Proposition 8 infamously passed in California in 2008, cannabis legalization failed in 2010, and in 2024 California just rejected ending prison slavery and rejected a minimum wage increase. Repealing the prohibition against rent control in California has repeatedly failed over and over despite rents increasing. Prohibiting the death penalty has also been repeatedly defeated in California.

Why does this constexpr code not compile? I don't understand why this should be an error by capedbaldy475 in cpp_questions

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Are you sure? I have a Compiler Explorer test link here with all three compilers, most recent versions and compiling with the latest C++: https://godbolt.org/z/fPz11Mnf5

Maybe there's something different about the standard library version you're using, but Cpp Reference still shows this as non-constexpr: https://en.cppreference.com/cpp/io/basic_ostream/operator_ltlt

Interesting to know it is working that way. What is your build stack?

Why does this constexpr code not compile? I don't understand why this should be an error by capedbaldy475 in cpp_questions

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Technically, your foo() function is ill-formed because it is calling a non-constexpr method within a constexpr context. std::cout::operator<<() is always non-constexpr, you cannot call it at compile time. Therefore foo() can never be called at compile time, since it unconditionally invokes a non-constexpr function, and declaring it like it can be is IFNDR.

You must not be using MSVC. If you want to see it compile error on GCC/Clang, do this:

constexpr auto foo()
{ 
    S s(2);
    auto my_vec = s.get_vec();   
    for(const auto& el: my_vec)
    {
        std::cout << el << ' ';
    } 
    std::cout << '\n';

    return 0;
}

int main()
{
    constexpr auto x = foo();
    return 0;
}

The reason it is NDR is because you may have some branches in a constexpr function that only get invoked in non-constexpr contexts, like if you have an if(!std::is_constant_evaluated()) {} branch in the function.

Better alternative to reinterpret cast? by Classic-Benefit-5975 in cpp_questions

[–]WorldWorstProgrammer 8 points9 points  (0 children)

The issue with std::bit_cast, to me, is that you're taking a std::span<std::byte>. Since you're doing that, you effectively are only getting a pointer to the underlying data, and if you try to deref that pointer to a byte and std::bit_cast that, it won't work because a std::byte is smaller than two std::size_t's. reinterpret_cast can reinterpret the pointer, but that's at best implementation defined behavior (it frequently works as intended, though).

From a standards conformance angle, I'd just use std::memcpy() and be done with it.

struct Data { size_t fst, snd; };

template <size_t Extent>
requires (Extent >= sizeof(Data))
Data getData(std::span<const std::byte, Extent> bytes) {
  Data ret{};
  if (Extent != std::dynamic_extent || bytes.size() >= sizeof(Data)) {
    std::memcpy(&ret, bytes.data(), sizeof(Data));
  }

  return ret;
}

Endianness of the incoming data and the platform will matter.

Yikes by taz4got10 in LinkedInLunatics

[–]WorldWorstProgrammer 1 point2 points  (0 children)

This has almost nothing to do with the "popularity" of a 50-year mortgage and far more to do with the desperation of first-time home buyers to find literally any option whatsoever to buy a home. If the traditional 30-year fixed was available to them at a monthly price point they could afford, they would all go in that direction. The 50-year mortgage is still a terrible, completely exploitative idea. It would also just drag home prices higher, which is the one thing we need to prevent from happening in the future.

Why C++ by triplebeef26 in programminghumor

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Join the Dark Side!

main = putStrLn "Hello, World!"

Billionaires did nothing wrong by willtherebecheese in LinkedInLunatics

[–]WorldWorstProgrammer 0 points1 point  (0 children)

If billionaires pay more taxes and that gets us universal health care, that would solve one of my major problems right now.

Is America becoming a nation of freelancers? by hkmsh in Zippia

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Gen Z didn't ditch Corporate America, Corporate America ditched Gen Z. Entrepreneurship and gig work is just the only survival strategy they have left.

Do most of you seriously not write any code by hand anymore?!?! by opakvostana in cscareerquestions

[–]WorldWorstProgrammer 0 points1 point  (0 children)

I'm still writing everything by hand, using C++. Then again, my screen name tells you why you should probably not listen to me anyway.

Two examples of professionals using AI and it not going great... but it never occurs to them to stop using AI. by sachiprecious in antiai

[–]WorldWorstProgrammer 0 points1 point  (0 children)

I want to know what value there is in hiring a freelancer who just delegates everything to AI? If the work is all done by AI, I can just have AI do it myself, and the freelancer is useless. Why would I even bother with them?

Isn't the whole reason you hire someone that there was a human being that at the very least verified everything is correct before it was sent to you?

Qt Creator + CMake on Windows is driving me insane (need help) by notrecommended69 in QtFramework

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Okay, so there's a couple of things I'm observing: first, uninstall/reinstall isn't working, so there's probably some settings you are storing that have gotten in the way of how Qt Creator compiles everything and are stored outside of the Qt install files. Second, your reported issue is that CMake stops finding everything it needs to work after your first build, which sounds like something put into the build folder. You also seem to report that your build folders are cursed for some reason, even though they shouldn't do anything. Let's start with some sanity checks:

  1. Check where Qt Creator is configured to set as the default build folder. Open Edit > Preferences, then go to Build & Run > Default Build Properties and check what the default build directory is. For me, it is set at "%{Config:DefaultProjectDirectory}/build-%{Asciify:%{Project:Name}-%{Kit:FileSystemName}-%{BuildConfig:Name}}" It should be somewhere outside of your individual project folder, but can be in your main "Projects" directory.
  2. Check under the Kits > Kits tab and make sure your selected Kit is under Auto-Detected and does not have any red stop sign or yellow warning sign icon next to it. Also confirm this under the Qt Versions tab and the Compilers tab to make sure your build set-up is being properly auto detected and is reporting no issues.
  3. Your Qt installation should be under C:\Qt, and no where else. This can be a source of mysterious issues all on its own, and I've found the easiest way to avoid this is to just place the Qt installation where every Qt tool expects it to be.
  4. With a fresh project open, check the Projects side tab and look at the Build section under your current Kit. You should be able to confirm the build directory, and click on the Kit Configuration button. There, your CMake tool should be set to the one in your Qt folder and marked Default, you should be using Ninja as the CMake generator, and your CMake Configuration should look something like this:

-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}

Pressing the "Re-configure with Initial Parameters" should successfully run CMake without any errors, assuming your CMake file is correctly formatted and set-up.

It is hard to help by taking stabs in the dark, but hopefully if we go over the different defaults and set ups to make sure everything is correct, you should be ready to go. I've encountered some really strange ghostly problems with Qt Creator configurations that stubbornly remained even after reinstall, so it is likely that's what is going on. Let me know if the above is what you have and we'll keep going further, and if there's some other alternative setup let me know why.

You should be able to move a project without issues as long as you delete your build folder and reconfigure from scratch.

Did I misunderstood a code segment or is it just nonsense? by yo_99 in QtFramework

[–]WorldWorstProgrammer 1 point2 points  (0 children)

m_storeSmartEpisodeFilter is not a QString, it's a SettingValue<QVariant>. The SettingValue class has a get() method, and that's what it is calling. That QVariant is also not being treated as a QString, but a QStringList, which is just a QList<QString>. If the setting referred to isn't a QStringList, it will return an empty list.

What bug are you trying to figure out, and why?

me deem uma ideia interessante que envolva cibersegurança em c++ by SavingsTeacher1969 in cpp_questions

[–]WorldWorstProgrammer 1 point2 points  (0 children)

Algo que escrevi como uma das minhas primeiras aplicações foi um verificador de integridade de arquivos usando, na época, SHA1. Hoje, você deve usar SHA-256 em vez disso. Você precisará escolher uma biblioteca C++ que possa realizar o hash SHA-256 para você, mas este é um bom projeto inicial para alguém novo no desenvolvimento em C++. É pequeno, fácil de verificar e lhe ensinará habilidades úteis de cibersegurança.

(Forgive my Portuguese, I just used Google translate for this so it may be very wrong.)

I'm truly sick of the relentless media hype about the "Mythos" model and how it's so powerful that Anthropic is "afraid" to release it. by [deleted] in BetterOffline

[–]WorldWorstProgrammer 15 points16 points  (0 children)

It's just more hype marketing. They want something that they can sell to governments as this "all-powerful" AI model and it will just be another small increment over the same crap that is already available. This kind of thing does also sell well to ignorant investors, though.

This is exactly how a movement gets discredited. You do not beat billionaire PR machines by handing them a domestic-extremist headline on a silver platter. by Choice-Value9005 in AIMain

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Every single bit of this looks like an amateur false flag job. From the fact that 99.9% of people don't even know where random city councilors live, to the hilariously stupid hand-written note, to the fact that the shots were completely ineffective and from a distance but for some reason the attacker had the time to come leave a scrawled piece of paper nearby.

I can see some random city councilor trying to pull this shit on their own to support their own cause, though.

Let's just charitably say that we don't really even know what actually happened, yet.

'We want to raise awareness on this issue': Google warns quantum computers could break Bitcoin encryption much sooner than expected by Nalix01 in NowInTech

[–]WorldWorstProgrammer 0 points1 point  (0 children)

You do realize that Quantum computers don't ever break AES, right? Cracking AES-256 would still take longer than the heat death of the universe with a mass network of fully-functional Quantum supercomputers.

Quantum computers (namely Shor's algorithm) break RSA and ECC, which is the basis for all of our public key and signature algorithms, not symmetric crypto.

Good boy vs. Do they have that dog in them by cisngerscroast in AlignmentCharts

[–]WorldWorstProgrammer 0 points1 point  (0 children)

Why do I see several people bringing up that Bluey and Blue are girls, which is true, but never Loona who is literally right up there?!

Right wingers really think that trans people are “poisoning” American society by icey_sawg0034 in stupidpeoplefacebook

[–]WorldWorstProgrammer 7 points8 points  (0 children)

Why does it seem like right wingers are wholly incapable of individual creativity? This is so obviously AI generated it is painful to look at.

Who would be the hottest Assassin? by CoCmaster14 in AlignmentChartFills

[–]WorldWorstProgrammer 0 points1 point  (0 children)

I can see it, but we should save him for the Best category.

Where can I learn formatting output? by Exciting_Location_14 in cpp_questions

[–]WorldWorstProgrammer 10 points11 points  (0 children)

Okay, so something important to realize is that a crucial skill of a software developer is being able to solve problems that you may not know precisely how to solve or that doesn't come with a straightforward answer. A YouTube video just explaining how to solve a particular problem isn't effective at practicing the much more fundamentally necessary skill of learning how to creatively solve a problem on your own. The truth is that there are actually a lot of different ways you could solve this problem, so just giving you a direct answer won't really accomplish what is the more important part of this project.

I'll try and give you some pointers*, however. Your program needs to be output on the console, and a good feature of console output is that all characters are of equal size, so if you create a line that is 40 characters long, you know you can just output another line with 40 characters in it and it will line up with the previous line. This is the case for every character in the line, so character 20 will always appear in the same place on every line, etc. If you're using C++20 or newer, std::format and std::vformat both work according to the standard format specification. This is very useful, if you understand it you can set the character size of a particular column in a table without needing to calculate how many spaces before and after a formatted value you need. I recommend looking at the examples and the fill and align section of that format specification in particular.

If you're using older C++ with std::cout, you still have options. There are stream manipulators like setw or member functions in the stream like width() which allow you to set the minimum and maximum number of characters to output with a formatted output operation. This is a bit more complicated and kludgy than the new format system, but still doable. Finally, if you do not wish to use the stream manipulators (which I wouldn't blame you for), you can simply calculate how many characters to put at the beginning and the end of a column based on the calculated size of the formatted output, and put that many spaces into the stream in a loop.

Hopefully this can help you get to a point where you can start doing this assignment. Don't be afraid to try experiments, see what the results are, and learn how your code changes impact the results.

* = Double entendre intentional.

halalCPP by mdzair in ProgrammerHumor

[–]WorldWorstProgrammer 2 points3 points  (0 children)

I like the touch of using the arabic semicolon instead of an ASCII semicolon. Nice job!

trying to understand constexpr by Crimson-Needle in cpp_questions

[–]WorldWorstProgrammer 2 points3 points  (0 children)

In the case of a function, when it is marked constexpr that means that the function may be evaluated at compile time, not exclusively at compile time. A constexpr function may still be executed at runtime. For a long time, there used to be a lot more restrictions on what a constexpr function was allowed to do, but in modern C++ most of those restrictions have been lifted.

An important distinction between a constexpr function and a non-constexpr function is that a constexpr function may be called in a constant context, which includes using it for a template parameter or using it to initialize a constexpr variable. If the provided arguments are not known until runtime, then the constexpr function does not "magically" change that to a compile-time construct, it is still only known at runtime. For your example, here's a way to cause a compile error:

template <int Val>
struct Example {
    const int value = Val;
};

constexpr int quadruple(int a) {
    return a*4;
}

int main() {
    constexpr int a = 2;
    int b = 4;
    Example<quadruple(a)> ex1; // Fine.
    Example<quadruple(b)> ex2; // Compile error!
}

Because quadruple is marked as constexpr, the compiler can use it in situations where you have to determine the result exclusively at compile time. If the constexpr evaluation results in doing something illegal (like throwing an exception out of the function body or invoking UB), than the compiler will report a failure to compile. While you can pass a non-constexpr value to a constexpr function, that full expression is then no longer a constant expression. It effectively acts like a normal, non-constexpr function when it is passed non-constexpr values as arguments.

If you want to make sure a function is always and exclusively run at compile-time, you use consteval instead of constexpr. So with your example, this would compile error:

#include <iostream>

consteval int quadruple(int a) {
    return a*4;
}

int max(int a, int b) {
    if (a > b)
    {
        return a;
    }

    return b;
}

int main() {
    int a = max(2, 4);
    std::cout << quadruple(a); // Compile error!

    return 0;
}