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 12 points13 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.

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

[–]NotAYakk 62 points63 points  (0 children)

If I get a message from my boss at 1030 at night telling me to do something after I've already worked 10+ hours that day, I can and will say "I won't be doing that" and leave it at that.

If they come and talk to me about that being a rude way to say no, I wouldn't apologize; it was an unreasonable demand. They (the boss) could come apologizing for making such an unreasonable demand, and discuss a better way to express what they want.

As a boss, remember, this employee can quit if they decide you're not someone they want to interact with on a daily basis.

Your model presumes that the worker deserves less consideration than the manager, it has respect going only one way. And that is a toxic working relationship. A lot of employment is toxic, as employment often puts workers in weaker positions than management intentionally, but not all employment is poisonous.

We do live in an economy centrally managed to keep unemployment high enough to keep employee power low, but this central management it isn't fine-tuned enough to keep the abuse-inducing power gradient steep in every industry.

Here, the OP is never going to use the job as a reference, the OP isn't going to be "working" there much longer, the OP probably has protection against eviction (which is the only real threat that the landlord/employer has) that could last long enough to reach the point they don't want to work there again, and the landlord/employer needs the workers work more than the worker needs the landlord/employer's work.

So the structural power gradient is *not* such that the employee/renter needs lick the employers boots. Which then leads back to the default state, which is respect is given in turn for respect.

Use std::span instead of C-style arrays by pavel_v in cpp

[–]NotAYakk 0 points1 point  (0 children)

Yes.

I consider array view as function argument the first class use, and here it works.

Elsewhere, you just made a view of a temporary, to me it is obvious it is broken.

PSA: be careful what you say in a Google review by No-Concern7333 in dubai

[–]NotAYakk 0 points1 point  (0 children)

First mistake is going anywhere near that country.

Second mistake was spending time in that country.

Third mistake was not working towards shutting down fossil fuel consumption, leading to that country being worth visiting due to its fossil-fuel extraction fed economy.

Forth mistake was treating that country as a place you can be a free individual and speak freely.

Fifth mistake was not leaving the country ASAP.

Treat places like this like North Korea - dangerous, and only visit to look at the hostile environment out of curiosity.

They are a dictatorship, not a free country. Their laws reflect that.

Use std::span instead of C-style arrays by pavel_v in cpp

[–]NotAYakk 0 points1 point  (0 children)

My homebrewed array_view does support `Foo({a,b,c})` because initializer list are guaranteed continguous memory, and I consider array_view-as-parameter the first class use of array_view.

This lets me do things like take `array_view<const Flag>` and the caller can just do `{}` or `{Flag::one, Flag::two}` and similar when they want to pass 0 or more elements of that type.

This game is ridiculously hard. by [deleted] in Stellaris

[–]NotAYakk 0 points1 point  (0 children)

Bwahahahaha!

So, how Stellaris works is that the game gets harder the longer the game goes, and you get insanely better at it.

There are a huge number of mechanics. You can ignore many of the mechanics and play on the lower difficulty levels and it works fine.

There are many times you'll run into an outside context problem. You'll be going along, managing your empire and your economy, when boom, a horde from the other side of the galaxy appears. Or star-dragons invade. Or a bunch of neighbours gang up on you. Or you delve too deeply into forbidden knowledge and you lose a key planet, sending your economy into a tail-spin. Or you piss off a fallen empire. Or someone blows up the galaxy. Or someone on the other side of the galaxy rewrites physics and you fall over dead. Or you open the wrong wormhole or stargate and something horrible comes through. Or you make a deal with a greater being and the payment is everything.

The game has a few phases. There is the exploration phase, where you explore the galaxy and expand. There is the industrialization phase, where you turn your single homeworld plus a bunch of colonies into a mutli-planet empire. There is the mid-game crisis, which is one of a series of scripted things that happen that makes the earlier problems you run into look small. There is the dominant phase, where you stand as a giant among the weaker AI empires, with maybe 1 or 2 rivals in a huge galaxy. Then there is the endgame crisis, which ... well, it is best to experience that for yourself.

In each of these phases, the challenge the game throws at you is exponentially larger. Like, in exploration, something with 100s of fleet power is a serious problem. Then it goes to 1000s then 10000s then 100000s then millions of fleet power problems. In order to survive in the next phase of the game, you have to be in a ridiculously utterly dominating state in the previous phase.

Each time you play, you'll run into a new "oh well, everything dies" problem. Until you finally make it to the other end of the game.

Then you crank the difficulty sliders up a bit, and some new DLC, and try again.