Errors, bugs, questions - page 2325

 
Ilyas:
Were there good reasons to abandon the operator ->?
 
TheXpert:
Were there any serious reasons to abandon the operator ->?

No, there were no serious reasons.

The only justification for its absence is concern for immature minds of users not familiar with C++.

 
fxsaber:

Is the double negation optimised by the compiler?

Yes, it does.

 
Ilyas:

No, there were no serious reasons.

The only justification for its absence is to care for the fragile minds of users not familiar with C++.

I don't think anything bad will happen if you add it.

You may allow using a point with pointers where there's no ambiguity for some time.

And of course issue a warning.


 
How can I add a button to products in the marketplace: "Download Trial"?
 
Koldun Zloy:

I don't think anything bad will happen if you add it.

Fora while , you may be allowed to use a point with pointers where there is no ambiguity.

And of course issue a warning.

Why make it so complicated? It's enough to make . and -> equivalent, interchangeable records.

Figuratively speaking

#define ->   .
 
fxsaber:

Yes, there is ambiguity in your case. In a good way, there should be at least a compiler warning for this kind of thing.

In my case, which is much simpler, everything is clear. I think C++ agrees with that too.

What I mean is that in my case MQL implies option (2), while C++ implies option (1). I.e. you have imaginary clarity - a small change (of class A) and the meaning dramatically changes
 
A100:
You have imaginary clarity - a small change (of class A) and the meaning changes dramatically

This is a change to the class and should result in a corresponding compiler message.

If it's not there, it's a total clarity.

 
Ilyas:

As a temporary solution, use the '!' operator. (logical not).
We will think on the solution (can we change the behaviour now, when there is a lot of code ?)
It is possible that for a pointer, a bool conversion operation would be an operation on the pointer and not on the object it points to.

Without changing the existing codes, it won't work... The whole concept of pointers as dynamic objects collapses

I mean, instead of just writing

class A {
public:
        bool operator*( A* a ) { return true; }
};
void OnStart()
{
        A *a, *b;
        if ( a * b );  //(1)
}

we'll have to write a confusing one.

        if ( *a * *b );//(2)

And all this for what? So that a pointer could be checked for NULL? - There is a comparison operator for that:

        if ( a != NULL );//(3)

Why duplicate it?

 
A100:

the whole concept of pointers as dynamic objects collapses

there is no concept now, an object and a pointer to it are mixed in one pile
Reason: