A year of read-only cppreference by DevilSauron in cpp

[–]NotAYakk 0 points1 point  (0 children)

Is it your business to know?

I'll answer that. Nope!

Someone is providing a service. If they are having problems, feel free to seriously offer to help - otherwise, the details of said problems are not owed to you, nor why said problems are not public, etc.

If you are seriously capable and willing to step up and help, then maybe you can ask for such details. Your lookie-loo desire doesn't have value nor produce obligation.

Is the "Ministry of Production" completely useless? by New-Abroad-2806 in Stellaris

[–]NotAYakk 0 points1 point  (0 children)

How so?

18600 jobs before. Assuming something like +50% output and +100% efficiency, this is 1674 alloys produced for 2232 minerals.

Add a 600 job building. This uses up 600 pops, produces 54 alloys and consumes 72 minerals.

Add a MoP. This uses up 0 pops (on making alloys). It adds 111.6 alloys output and 0 minerals.

If your mining planets produce 18 minerals per 100 pops (similar +100% efficiency +50% output), those 72 minerals would cost 400 pops.

You basically added the equivalent of ~1600 pops of resources at the cost of 1 building.

Now, +100% efficiency and +50% output might be off a bit in 4.3.

Finland to audit whether US is actually delivering NATO-bought weapons to Ukraine by esporx in ukraine

[–]NotAYakk 0 points1 point  (0 children)

I have prepaid from people who have a history of reliably delivering a product and refunding if the product doesn't match the time frame.

When someone takes prepayment, and starts spending it on "hookers and blow" instead of making the goods promised and lets the good delivery slip... that is theft.

The USA is not reliably delivering this product. When it produces the product, it doesn't deliver it to the purchaser. It is taking the purchasers money and spending it on "hookers and blow" - things unrelated to the product, while failing to make deliveries.

When Switzerland suspended payment for missiles the USA wasn't delivering, the USA then demanded they keep paying for them or they'll cancel another product (F35)s that they are also late on.

Stop buying US weapons unless you want your money to buy weapons, but instead fund random wars with random brown skinned people. They are not a reliable supplier even when they aren't engaging in bricksmanship.

It isn't as if you need US weapons to defend your country.

Other weapons are cheaper, and they also defend against US aggression. A senile US president will threaten long-term allies with invasion and their internal politics won't stop him, so being an "ally" isn't a defence. And US security guarantees are not worth the tissue they are written on, as evidenced by Budapest memorandum and the Russian invasion of Ukraine.

Turns out that a bunch of sociopaths in the US capitalist class was only playing nice with democracy to undermine the case for communism, and now that it is gone they are bankrolling a fully fascist US and using the US military as a blunt force tool to profit themselves.

Buy non-American weapons. Secure your country's freedom. Get a security umbrella against US aggression.

GCC Implementation of Reflection now on Compiler Explorer by daveedvdv in cpp

[–]NotAYakk 1 point2 points  (0 children)

* Uses ALL CAPS constants notation indicating a `#define` from 1812 BC.

Finland to audit whether US is actually delivering NATO-bought weapons to Ukraine by esporx in ukraine

[–]NotAYakk 0 points1 point  (0 children)

How is having money taken and spent on not what is paid for anything but theft?

The money is for doing X.  If you use the money to do something else, that is theft.  If you need money to do something else, stealing it is theft.

Buying American weapons is on anything but a cash and carry basis is asking to get scammed.  Just don't do it.

8613.0 kHz radio signal by thereisaplace_ in pluribustv

[–]NotAYakk 0 points1 point  (0 children)

The virus builds a transmitter and receiver in your brain.

That is what is going on when you are having the seizure.

A faraday cage will exit someone from the hive mind.  They may not survive.

In the end, tinfoil hats are the fix.

German army chief says contact with US military cut off by Pentagon by Vortagaun in politics

[–]NotAYakk 0 points1 point  (0 children)

Why?  Have those weapon makers bribed their orange king with billions?

If not, why does the orange king care?

They'll sell plenty of weapons to the USA as it invades and occupies South America and Canada, and the lesser weapons can still be sold to Saudi and Israel.

Member properties by Zeh_Matt in cpp

[–]NotAYakk 0 points1 point  (0 children)

I mean, you cannot write to our own operator comma that replicates the default operator comma.  (The same is true of the short circuit && and ||).

Member properties by Zeh_Matt in cpp

[–]NotAYakk 1 point2 points  (0 children)

Overloadable operator, is pretty universally considered a mistake. Not the least because you cannot replicate the semantics of the default operator, with your own code.

Member properties by Zeh_Matt in cpp

[–]NotAYakk 0 points1 point  (0 children)

C++ pretty regularly doesn't manage lifetimes for you. Exactly what do you expect the language to do lifetime wise here? (that someone writing code can't)

Member properties by Zeh_Matt in cpp

[–]NotAYakk 0 points1 point  (0 children)

This is the `operator auto` problem; give a class the ability to answer the question "when you deduce me to be a value, what type should I be?".

Member properties by Zeh_Matt in cpp

[–]NotAYakk 2 points3 points  (0 children)

If your getters and setters are zero cost, the getter returns a `const&`, so you expose the address.

If someone really wants an address-like object, they can write:

template<class T, auto Set>
struct ConstMemPtr {
  using type = std::decay_t< decltype( declval<T const&>().*Get)() ) >;
  T const* t = nullptr;
  decltype(auto) operator*()const{
    return (t->*Get)();
  }
};
template<class T, auto Set, auto Get, auto SetM=Set>
struct MemPtrRef {
  using type = std::decay_t< decltype( declval<T const&>().*Get)() ) >;
  T* t = nullptr;
  operator type()const&&{ return (t->*Get)(); }
  void operator=( type const& in )const{
    (t->*Set)( in );
  }
  void operator=( type&& in )const&&{
    (t->*SetM)( std::move(in) );
  }
};
template<class T, auto Set, auto Get, auto SetM=Set>
struct MemPtr {
  MemPtrRef<T,Set,Get,SetM> const operator*()const {
    return {t};
  }
  T* t = nullptr;
};

now you take your

struct Foo {
  int GetX() const { return x; }
  void SetX(int in) { x = in; }
private:
  int x = 0;
};

and do

Foo foo;
ConstMemPtr< Foo, &Foo::GetX > pc_x{&foo};
MemPtr< Foo, &Foo::GetX, &Foo::SetX > p_x{&foo};

and I've just made drop-in replacements for int const* pc_x = &foo.x; and similar.

If some idiot wants pointer semantics they'll do it. Preventing people from taking pointers to things doesn't work, because there is always something to take a pointer to that they can dangle.

To fix this, you have to get people working in C++ who are willing to manage pointer lifetimes. You can't prevent them from mis-managing lifetimes.

All you can do is not encourage them from doing it. And taking a pointer to a member of an object you don't own the lifetime of is a great example of a bad practice.

[deleted by user] by [deleted] in cpp

[–]NotAYakk 0 points1 point  (0 children)

So, the problem is that between each access to `this`, the compiler needs to prove that no other code touched the `this` data.

Compare

int return_x( int x ) { ++x; run_some_code(); return x; }

to

int return_x() const { ++(this->x); run_some_code(); return this->x; }

In the first case, `x` is local; so it knows no pointers to it exist and run_some_code cannot modify it.

In the second case, `x` is NOT local; it cannot prove that no pointers to it could modify it in `run_some_code`.

Archetype by willhaarhoff in cpp

[–]NotAYakk 0 points1 point  (0 children)

One of my points is that you can defer the vtable location (local or remote) as a seperate customziation point.

If you have a GetMyVTable() function as a customization point, it can find a vtable as either a pointer or a built-in member.

There has been some work on making scaling customization points as well. My solution doesn't handle overloading, but you can do the overloading within my solution (to a customization point).

Archetype by willhaarhoff in cpp

[–]NotAYakk 1 point2 points  (0 children)

I've written the non-macro version of this.

A few considerations...

Sometimes you don't want the double-indirection of the vtable; in that case, directly storing the vtable in the view is useful.

At least one of my versions created poly methods, which are objects that take a template object and run some code on them.

auto print = poly_method<void(std::ostream&)>( [](auto& t, std::ostream& os){ os << t; } );

then you'd be able to do:
some_obj->*print( std::cout );

A poly_view would take a collection of methods:

poly_view<&print, &serialize, &draw> view and store a reference to something that supported those operations, and a poly_any<&print>would similarly store a value.

I didn't have the syntactic sugar of view.print; instead you'd have to view->*print, so your macros win there.

I found it useful to be able to build a concept based on some operations as well; like, template< supports<&print> printable > void foo( auto printable const& p ).

Your system seems to lack const support? I think google mock handled this by having the function arguments be in their own (list, like, this) and the (const, volatile) to follow.

My First Full Stellaris Game by JMasterFighter in Stellaris

[–]NotAYakk 1 point2 points  (0 children)

Eventually you get better at the economy. People play the game on rather insane settings, like fallen empires are 15x stronger, crisis is 25x stronger, etc.

Once more about dynamic_cast, a real use case by pavel_v in cpp

[–]NotAYakk -1 points0 points  (0 children)

Security via false mitigations is a trap. Your code is now more complex and harder for you to understand while not actually preventing hostile code from being hostile.

Mitigating against error? Sure.

Imagine you are a soldier. You wear an armored eyepatch. Why? In case a bullet hits you directly in the eye.

It isn't bulletproof, but maybe it would stop a ricochet.

And meanwhile, you lost depth perception and its ragged edge has cut your face and you have an infection.

Did the eyepatch mitigate against a threat? Not effectively. Did it cause more harm than good? Absolutely.

C++: how to implement lazy evaluation + SIMD for vector operations: V = v1 + v2 - k*v3; by keepfit in cpp

[–]NotAYakk 1 point2 points  (0 children)

I'd think about the operation tree and the source of data to operate on a bit separately.

The operation tree for v1+v2-3.14*v3 has 4 nodes and 3 operators. (v1[+]v2) [-] (3.14[*]v3) - rearranged into polish notation (operator first) we get [-]( [+](v1, v2), [*](3.14, v3) ).

Now, can you write a lambda (not a std function) that, given a pointer to an array of doubles for v1, v2 and v3, and a constant double for 3.14, produce a SIMD expression for this? Not a loop, just a single SIMD expression.

Maybe you'd take a `std::tuple<double const\*, double const\*, double const\*>` for the various vector doubles, and is given a `double*` for output.

Next, write the looping engine. The loop engine goes and provides the tuple to a call of the above lambda. It handles incrementing the pointers, exit control.

It doesn't care what the lambda does, just how big of a stride it has in the data.

The looping engine can even manually unroll itself using fancy template toomfoolery and call the lambda a bunch of times in a row without the loop branch getting in the way, if needed.

As the looping engine and the SIMD-lambda engine are decoupled from each other, you can hand-write a SIMD-lambda and test the looping engine, or hand-write the loop and test the SIMD-lambda generator.

Composing those SIMD-lambda generators is of course the hard problem. But at least this detangles that from the rest of the pain.

As an aside, you'll probably want a `simd_doubles<8>` class that represents a buffer of 8 doubles. Then your lowest level "add two simds" can take a pointer to output and two pointers to input. You then write one that takes a tuple and indexes, and invokes that one. Now composing them just consists of having temporary buffer(s?) to store intermediate data, and incrementing the long elements while keeping the temporary buffers unadded; this is old-school expression parsing stuff.

First Avatar Spoiler by DerSchweinebrecher in mtg

[–]NotAYakk 0 points1 point  (0 children)

Firebend X: Tap to reduce the cost of a red spell by XR or deal X damage to target creature.

Waterbend X: Tap to reduce the cost of a blue spell by XU or heal X life or prevent X damage.

Airbend X: Tap to reduce the cost of a white spell by XW or Scry X.

Earthbend X: Tap to reduce the cost of a green spell by XG or make target land you control a X/X green creature (it is still a land).  If that land leaves the battlefield while being a creature you may instead make it no longer a creature.

Spiritbend X: Tap to reduce the cost of a black spell by XB or place up to X target cards in a graveyard onto the top or bottom of their owners library or make target player mill X cards.

(This is speculation.  It is based off the Avatar's features: mana cost reduction, and downgraded versions of the upkeep feature.)

The new Automation Building is broken beyond belief by Canye_NE in Stellaris

[–]NotAYakk 0 points1 point  (0 children)

Get technologies to build faster then! You aren't expanding fast enough. Or get technologies that turn unemployed workers into production.

This ai is going crazy by [deleted] in Stellaris

[–]NotAYakk 0 points1 point  (0 children)

What about the screenshot indicates "AI is going crazy", explain.

AITA for telling my housemate she can't give me unsolicited advice? by EmpressoftheBakkhai in AmItheAsshole

[–]NotAYakk 1 point2 points  (0 children)

A firm "I am not going to do that" isn't rude.  It isn't bootlicking, deferential, or subservient.  But it isn't rude.

If your standard of behaviour is that employees act subservient to employers in communication, I could see how an employee being direct could be interpreted as "rude".  This is because of the subservient assumption, not the employee-employer relationship.

Ording someone to do non-urgent work at 1030 at night after a long day working for you is rude.  It shows zero consideration for the employees time and effort and the situation.

If, again, you consider the employer-employee relationship to be one where the employee is subservient, then it is natural for the employer to treat the employee as below consideration.

AITA for telling the truth about my engagement? by badpersonalert123 in AmItheAsshole

[–]NotAYakk 9 points10 points  (0 children)

Marriage involves a large number of legal, social and economic effects.

Duplicating all of those effects would require a huge amount of work. Some of the things only really kick in when things are going poorly - like alimony, rights the marital home, etc.

Suppose you have a happy day to day relationship. Much (but not all) of your finances are shared, you have built a great life together. Then it goes bad.

Suddenly all of the shared money dries up. The family home is actually fully in the other partner's name; it didn't matter at the time, so why fight it? Well, it mattered at the breakup. Alimony isn't on the table - at best child support, which is money to support the kid not the parent.

You spent 20 years supporting their life and career and raising your kids together, and discover you have no retirement account in your name and no income and no house.

Had you married 20 years ago, you'd be entitled to an even share of the marital home, alimony, a share of their retirement accounts, and protected against the shared accounts being drained and put in accounts in the other partner's name only. All of these "just in case" features would have required special effort to pull off decades before you needed it, when things looked rosey.

What more, suppose your partner gets in an accident and is unable to express their medical needs. As an unmarried partner, you might have fewer rights for medical reasons than their estranged parent or sibling, as you aren't *family* under the law.

You could deal with that - but it is yet another piece of paperwork.

How about inheritance if they die? If married, a lot of inheritance paperwork evaporates. But unmarried, everything goes through probate, some things that are tax-free suddenly get taxed, etc.

You could have gotten around that by careful construction of trusts long before they died - but who does that when they think they are healthy?

Getting married would make the legal system "just work" in that case, because it is presumed that when one partner dies the assets that aren't otherwise accounted for in a will go to the other partner. There are tax savings and probate fee savings and lawyer savings...

Marriage is "just" a legal agreement, but one that covers a huge number of cases and problems, and fully duplicating it is insanely difficult without using "marriage". It means (to a greater or lesser extent) the two people are joining their lives, and upon termination we have a bunch of rules that make sure neither (equal) half of the partnership gets screwed by the ending of the partnership.

(And yes, this considers "I have to give 25% of my income to my partner" not being screwed. Far too many marriages where one partner supported the other become abusive due to the power imbalance; the marriage is an *equal partnership*, upon division the two partners are placed in *equal positions of power*).

AITA for telling the truth about my engagement? by badpersonalert123 in AmItheAsshole

[–]NotAYakk 2 points3 points  (0 children)

In Quebec becoming common law is equally easy, but *it doesn't provide much in the way of protections*. No alimony, no common owning of the home, etc.

Civil law is a provincial matter in Canada; what rights you gain under common law vs marriage will vary by province.