The abbreviated notation of the postfix operator++ does not compile when an explicit conversion of a base class pointer to a derived
class A {
};
class B : public A {
public:
voidoperator++( int ) {}
voidoperator++() {}
};
void f( A* a )
{
((B *)a).operator++( 0 ); //нормально
((B *)a).operator++(); //нормально
++((B *)a); //нормально
((B *)a)++; //ошибка
}
class A {
public:
int f() { return ( 1 ); }
};
class B {
public:
B( const A *aa ) : a( aa ) {}
int g() { return ( a.f() ); } //должно быть предупреждение, поскольку a.f() не constconst A *a;
};
It's not the first time, but it's the only time you get such photos when uploading, which means you have to set some criteria (you probably have a certain size). ). They are displayed normally everywhere else. Please tell me what's wrong.
An unnecessary compilation error occurs if the macro uses a result type conversion and the return value is then not used (sometimes it is needed, sometimes it is not)
int g( int x ) { return ( x ); }
#define F( X ) (long)g( X )
voidOnStart()
{
int f = F( 0 ); //нормально
F( 0 ); //ошибка компиляции
}
A100: An unnecessary compilation error occurs if a macro uses a result type conversion, and the return value is not subsequently used (sometimes it is needed, sometimes not)
This has nothing to do with the use of defines.
A simple define equivalent will also give the same error
The abbreviated notation of the postfix operator++ does not compile when an explicit conversion of a base class pointer to a derived
At least the compiler should warn that a.f() is not const
Thanks for the heads up, both errors have been corrected.
But in the templates. I'll give you examples later.
Here too - it's not clear.
everything works correctly, but if you add the intermediate function ex2(...)
The result is different. What did ex2(...) do ? - just passed the pointers by reference on
Please take a look at
Here too - it's not clear.
everything works correctly, but if you add the intermediate function ex2(...)
The result is different. What did ex2(...) do ? - just passed the pointers by reference on
Please take a look at
It's not the first time, but it's the only time you get such photos when uploading, which means you have to set some criteria (you probably have a certain size).
). They are displayed normally everywhere else. Please tell me what's wrong.
An unnecessary compilation error occurs if a macro uses a result type conversion, and the return value is not subsequently used (sometimes it is needed, sometimes not)
This has nothing to do with the use of defines.
A simple define equivalent will also give the same error
P.S. Now there will be a vorning here.
After recompiling the indicator, the "array out of range" error started to occur when working with dynamic arrays.
It didn't occur before. What to do?