Errors, bugs, questions - page 2871

 
A100:

The output will be exactly string literal. Here is the proof there is no print at all:

I don't believe the compiler warning !

'+' is not a string ! It's a character type, in mql ushort 2 bytes

dot.

This is more likely an error in the description of the warning.

 
Roman:

I don't believe the compiler warning!
' It's not string ! it's a character type !

It's more likely an error in the warning description.

It's not a matter of faith and conjecture - we need proof: an example without a print proving that typename returns a non string literal is there ? When there is, let's continue.

 
A100:

It's not a matter of faith and conjecture - we need proof: is there an example without a print proving that a non string literal is returned ? When there is, let's continue.

Although typename returns a name, that's why it returns as string
maybe, but what difference does it make?
You got the type name and you got it. I don't understand what you want to prove to me?
That typename returnsa type string, well logically, it returns a name.
I meant that it returns the type name, i.e. the type is written in letters ))
I
didn't think at all what type it returns in and you clung to it.
Anyway, there's no point in arguing about it.
 
Roman:
Although typename returns a name, so it returns as string
maybe so, but what difference does it make?

You seem to have passed the stage of denial... the stage of awareness is beginning. I'll leave you to it.

 
A100:

You seem to have passed the stage of denial... the stage of awareness is beginning. I'll leave you to it.

Once again, I didn't claim that the type itself is coming back, I claimed that the NAME of the type is coming back.
What type is returning NAME, I haven't thought about that at all in our conversation.
That's why the realization stage isn't involved; it's clear that the name is a string, if it's a string.
But there is also mql ushort, damn it, so I doubted, that in typename will shove a 12-byte string.
If the type itself was returned, it would be a hoot at all ))
On the fly could be defined variables ))
I don't know if it's possible in compiled program, in fact it's usual memory allocation.

 
A100:

This is in abstract languages, but MQL does not have abstractness - supposedly it cannot be combined with speed

Here is another way to check, 12 bytes as string type

Print(sizeof(typename()));
 
Roman:

Here's another way to check, 12 bytes as string type

All the more, it means that the Documentation was correct (but this is also circumstantial evidence)

 
I cheated the system after all.

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

A100, 2020.10.09 00:38

Compilation error:
void OnStart()
{
    Print(typename("ushort"));      //(1) нормально
    Print(typename(typename('+'))); //(2) Error: 'typename' - unexpected token
}

Double typename

template<typename T>
T f( T ) { return typename(T); }
void OnStart()
{
        Print(f(typename('+')));
}

Result: string

So it's direct proof, not indirect.
 
A100:

All the more reason why the documentation is correct.

Yes, in the documentation to the templates, everything is described correctly.
typename is designed for templates, so it returns the type string
You just did not understand that I initially wrote that it returns type NAME, not TYPE name ))
And you started explaining to me the return string)
I was confused and I doubted, and thought that ushort can return.
But no, a string nevertheless.

 
Roman:

Of course it's my fault, I don't read the documentation and I made up the post

(typename)J

Forum on trading, automated trading systems and trading strategies testing

Bugs, bugs, questions

Roman, 2020.10.07 17:20

Yes, that is also a compilation error

#define  J '+'          // char

void OnStart()
{
    Print((typename)J);
}
#define  J '+'          // char

void OnStart()
{
    Print((typename)(J));
}

Reason: