Errors, bugs, questions - page 2211

 
pavlick_:

Is the class really a namespace class?

 
pavlick_:

Is there anything to the point? Where are the documented searches for names without qualifiers? From the reference:

---------

Syntax

Syntax of the MQL5 trading strategies programming language is very similar to C++ programming language, except for some features

  • there is no address arithmetic;
  • there is no goto operator;
  • you cannot declare an anonymous enumeration;
  • no multiple inheritance.

------------

Not a word about unqualified name lookup, and this is basic stuff. Well, it's up to the owner to learn the language from Renate's posts, lack of documentation and backward compatibility, but then the language gives the impression of being a child's plaything.

I support it, it's about time to abandon the help towards the language rules, because in essence mql5 is already another programming language

 
Konstantin:

I agree, it is high time to move away from the help to the rules of the language, because in essence mql5 is already a different programming language

Has it been said to the contrary somewhere?

 
Alexey Navoykov:

Is the class really a namespace class?

Yes, you're right, it does refer to namespace. There is a separate clause for classes, but the point is the same:

9.2.3.2  Static data members
[class.static.data]
2. The declaration of a non-inline static data member in its class definition is not a definition and may be of
an incomplete type other than cv void. The definition for a static data member that is not defined inline
in the class definition shall appear in a namespace scope enclosing the member’s class definition. In the
definition at namespace scope, the name of the static data member shall be qualified by its class name using
the :: operator. The initializer expression in the definition of a static data member is in the scope of its class (3.3.7).

[Example:
class process {
static process* run_chain;
static process* running;
};
process* process::running = get_main();
process* process::run_chain = running;

The static data member run_chain of class process is defined in global scope; the notation process::run_chain specifies that the member
run_chain is a member of class process and in the scope of class process. In the static data member definition, the
initializer expression refers to the static data member running of class process. — end example]
 
Alexey Viktorov:

Did I say the opposite somewhere?

Am I saying anything to the contrary? Why are you asking me a question?

 
pavlick_:

Compiler error:

Alert: 3

I don't see an error. I think this is correct.

First, we assign value 5 to the static member of the structure and value 3 to the variable.

Then the value of the variable is copied into the static member of the structure.

It is clear that this static member should contain the value we have assigned to the variable.

It all seems very logical to me.

 
Georgiy Merts:

I don't see the error. In my opinion, everything is correct.

Seems to me - all very logical.

Logic should be uniform, not selective (otherwise it's not logic)

If here

int a = 1;
struct A {
    void f();
    int a;
};
void A::f()
{
   a = 2; //(*)
}

(*) implies A::a = 2, not ::a = 2

it should also imply S::q = S::z, not S::q = ::z

 

I'm sorry. I don't understand. So, did you kill me? Or did you?

Can I pee in this forum?
 
B0biThec:

I'm sorry. I don't understand. So, did you kill me? Or did you?

Can I pee in this forum?

You've been banned for 24 hours for spamming. If you keep on spamming, it's a week ban, then a month, then you get your account deleted, and you piss in the right place.

 
Artyom Trishkin:

You have been banned for 24 hours for spamming. Continue spamming for a week, then a month, then delete your account, and pee in the proper place.

back from holiday?

Reason: