code:
#include<iostream>
using namespace std;
int main()
{
size_t i = sizeof new int;
cout<<i;
}
In GCC compiler, working fine without any warning or error and printed output 8
.
But, in clang compiler, i got following warning:
warning: expression with side effects has no effect in an unevaluated context [-Wunevaluated-expression]
size_t i = sizeof new int;
- Which one is true?
- Is
sizeof new int;
UB?
Aucun commentaire:
Enregistrer un commentaire