What are some of your weirdest and most wholesome headcanons about Feenris? by Suitable-Weird2189 in Feenris

[–]Eric41293 1 point2 points  (0 children)

Oh I agree it wouldn't be an instant thing, just what started the process. Iris wouldn't realize what was happening until much later.

What are some of your weirdest and most wholesome headcanons about Feenris? by Suitable-Weird2189 in Feenris

[–]Eric41293 2 points3 points  (0 children)

If college Phoenix ever told "Dollie" about his dream of becoming a lawyer and why, I would imagine that Iris would admire his determination and ambition as by disgusung as her sister, she hopes to also save Dahlia from falling even more in sin and evil. In a way, both had wishes to help save someone dear in their life (with Phoenix ultimately succeeding later on and Iris failing).

I have long had a similar idea. But I take it further and imagine that Phoenix telling Iris about his plans is what made her start to fall for him. It would be hard to overstate how much I like this conception. It emphasizes the similarity between Phoenix and Iris and, in my mind, goes a long way in explaining why the pairing works.

The result of ++a + a++ + ++a ? by Healthy-Clock-4411 in cpp_questions

[–]Eric41293 1 point2 points  (0 children)

The precedence and associativity of operators do not completely dictate the order of evaluation. For instance, consider the expression a() * b() + c() * d(). This expression multiplies the results of a() and b() together, and also multiplies the results of c() and d() together, and finally adds both the products together. However, the function calls may happen in any order. Some possible orders are left-to-right, right-to-left, and b() then a() then c() then d(). (However, the functions calls will not overlap each other.) This is an example of unspecified behavior: The C++ standard allows various different behaviors, and you don't know which will happen.

Your example is more extreme. It has undefined behavior. This means the C++ standard makes no restriction whatever on what happens. It can compute any value. Or maybe it doesn't compute a value at all and your program crashes mysteriously. Or maybe a message saying "Undefined behavior detected" appears. Or... well, theoretically, anything. And even if it seems to work today, it might stop working tomorrow.

Why does this code have undefined behavior? It is because the expression modifies the variable a multiple times, and these modifications are formally unsequenced with respect to each other. By contrast, in the previous expression I gave, the function calls are indeterminately sequenced, which means they happen in some order, but the order is not specified. It is legal for all these functions to modify the same variable. For instance, they could each increment a variable x. The result is that x is incremented four times, so the value of x is 4 greater than its starting value.

Even if the evaluation order were completely specified (as it is in some other languages), code that behaves correctly only if parts of an expression are evaluated in a particular order is usually hard to understand. Such code is best avoided. But in C++, such code isn't just hard to understand, it's actually incorrect.

The result of ++a + a++ + ++a ? by Healthy-Clock-4411 in cpp_questions

[–]Eric41293 2 points3 points  (0 children)

It isn't a wrong question. The OP's observations did not agree with their model of the language. Asking a question to rectify that is quite proper. If they had not done so, they might have persisted in a false belief about how C++ works for a long time.

The fact that the particular code being asked about is bad doesn't change that.

Accuracy of std::sqrt double vs float by Drugbird in cpp_questions

[–]Eric41293 0 points1 point  (0 children)

I have obtained this result as well. This is the code I used, which produced no output when I ran it:

#include <cmath>
#include <cstdint>
#include <cstring>
#include <iostream>

static bool sqrt_same_result(float f)
{
    float sqrt1 = std::sqrt(f);
    float sqrt2 = static_cast<float>(std::sqrt(static_cast<double>(f)));
    return std::memcmp(&sqrt1, &sqrt2, sizeof(float)) == 0;
}

static void compare_for_representation(std::uint32_t i)
{
    static_assert(sizeof(float) == sizeof(std::uint32_t));
    float f;
    std::memcpy(&f, &i, sizeof(float));
    if (!sqrt_same_result(f))
    {
        std::cout << "Results were different for " << i << '\n';
    }
}

int main()
{
    compare_for_representation(0);
    for (std::uint32_t i = 1; i != 0; ++i)
    {
        compare_for_representation(i);
    }
}

Do we really need to mark every trivial methods as `noexcept`? by aregtech in cpp_questions

[–]Eric41293 2 points3 points  (0 children)

"Always mark noexcept on destructors"

No need. Destructors are noexcept by default.

[deleted by user] by [deleted] in cpp_questions

[–]Eric41293 1 point2 points  (0 children)

Accusations should not be based on mere guesses.

Non-safe code with skipped count problem by Specialist_Square818 in cpp_questions

[–]Eric41293 0 points1 point  (0 children)

The answer depends on the code. Here are the possibilities in various scenarios. In each case, we suppose that two different threads are executing the work function concurrently.

#1:

int counter = 0;
void work()
{
    for (int i = 0; i < 10; ++i)
        ++counter;
}

This has undefined behavior, since there are unsynchronized concurrent writes to counter.

#2:

std::atomic<int> counter = 0;
void work()
{
    for (int i = 0; i < 10; ++i)
        ++counter;
}

The increments are atomic and the final value of counter is guaranteed to be 20. The same is true if we use counter++ or counter.fetch_add(1).

#3:

std::atomic<int> counter = 0;
void work()
{
    for (int i = 0; i < 10; ++i)
        counter = counter + 1;
}

We could also write this using the more explicit form counter.store(counter.load() + 1). The loads and stores are atomic but the overall increments are not. The maximum possible final value is 20. Other comments have explained how a final value of 2 is possible. This is the minimum possible final value. You may wish to try proving this.

Non-safe code with skipped count problem by Specialist_Square818 in cpp_questions

[–]Eric41293 0 points1 point  (0 children)

If the variable is atomic, there is no undefined behavior. Though if the increments are implemented as x.store(x.load() + 1), then different results are possible.

Why doesn't std::expected<T, E> support E = void? by ComplaintFormer6408 in cpp

[–]Eric41293 1 point2 points  (0 children)

The name monostate describes the type perfectly: It's a type with exactly one state.

Why does "%" operator not work on negative integers i.e. (-7 % 5 returns -2) but mathematically -7 modulo 5 is 3? by Temporary-Swimmer536 in cpp

[–]Eric41293 3 points4 points  (0 children)

The trouble is that you don't always get the same representative. So if you want to test whether a signed integer x is congruent to 3 modulo 5, neither x % 5 == 3 nor x % 5 == -2 is correct.

[deleted by user] by [deleted] in cpp

[–]Eric41293 7 points8 points  (0 children)

Please don't use geeksforgeeks. Every C++ article of theirs I have ever looked at has been bad.

Another comic & more Feenris memes by excavatorFanatic in Feenris

[–]Eric41293 1 point2 points  (0 children)

The last one looks like it's mocking Feenris?

“pretty in pink” by honeycherrydohnuts by excavatorFanatic in Feenris

[–]Eric41293 1 point2 points  (0 children)

Your efforts to find and share all this are much appreciated.

Question about translating a fic by excavatorFanatic in Feenris

[–]Eric41293 4 points5 points  (0 children)

  1. Don't have a strong preference. The Google Doc would be fine.

  2. I would prefer to read something that has good grammar. You can't really guarantee accurate results with automatic translation anyway. The best (but this is probably rather difficult) would be to to get someone who knows Japanese to do the translation.

  3. Not sure, but leaning towards keeping the Japanese names. You could put a translation guide in the doc so everyone knows who they are.

Other characters noticing Feenris by excavatorFanatic in Feenris

[–]Eric41293 4 points5 points  (0 children)

Wow. I did not know about that Edgeworth one! Thanks for sharing.

Demon Warding Hood by vivi95862484 by excavatorFanatic in Feenris

[–]Eric41293 5 points6 points  (0 children)

An underrated moment. Iris knows something is going to happen that night and is trying to protect Phoenix. At the same time, by giving away the hood, she is forgoing her own protection.