Errors, bugs, questions - page 2156

 
A100:

It depends on where - you need a complete example to answer the question

Anywhere that fits into the context. I find the entry itself somewhat absurd, despite its validity.

 
fxsaber:

Anywhere that fits into the context. The entry itself strikes me as somewhat absurd, despite its validity.

Before // the entry is normal... afterwards it's absurd.

 
A100:

Before // the entry is normal... after is absurd

I don't see anything absurd in wanting to assign a function field to a pointer to a method

typedef void (*fn)();

void g() { Print(__FUNCSIG__); }

struct A
{
  fn f;
  
  A() : f(g) {}
};

struct B : A
{
  void f() { Print(__FUNCSIG__); }
  
  void A100()   { this.f = this.f; } // не присвоить полю-функции указатель на одноименный метод, а на другой метод - пожалуйста:
  void A100_2() { this.f = this.h; } // 'h' - pointer to this function type is not supported yet
  
  void h() { Print(__FUNCSIG__); }
};

void OnStart()
{
  B b;
  
  b.f(); // void g()
  
  b.A100();
  
  b.f(); // void g()
}
 
fxsaber:

I see nothing absurd in wanting to assign a pointer to a method to a function field

What is absurd is that the compiler does not support pointers to simple methods, and even if it did, a pointer to a simple method and a pointer to a simple function will have a different signature, all other things being equal

 
A100:

a function pointer and a simple method pointer have a different signature

how is a static method different from a function in terms of signature?

 
fxsaber:

How is a static method different from a function in terms of signature?

static methods are no different than functions when the signature matches

 
A100:

Static methods are no different in signature from conventional functions

How is that a bad thing, then?

typedef void (*fn)();

void g() { Print(__FUNCSIG__); }

struct A
{
  static fn f;
};
static fn A::f = g;

struct B : A
{
  static void f() { Print(__FUNCSIG__); }
  
  void A100() { this.f = this.f; } // по смыслу ничем не отличается от A::f = B::f
};

void OnStart()
{
  B b;
  
  b.f(); // void g()
  
  b.A100();
  
  b.f(); // void g()
}
My point is that such hobbies lead to ambiguities. Which are useful except as one of the tests of language comprehension in job interviews.
 
fxsaber:

What's wrong with that, then?

My point is that such hobbies lead to ambiguities. Which is only useful as one of the tests for language comprehension in job interviews.
The bad thing is that in C++ the result will be different
 
A100:
The bad thing is that in C++ the result will be different

So it's not justified either.

 
fxsaber:

What is it?


After selecting "Save Version", the current parameters are saved to the built-in MT list, which can be used from the "Load Version" menu. The list is different for each EA.