-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Source:
long long int charPtrToInt(const char* str)
{
long long int a = (long long int)str;
return a;
}
int main() {
const char* str = "123";
charPtrToInt(str);
}
Output:
long long charPtrToInt(const char * str)
{
long long a = static_cast<long long>(str);
return a;
}
int main()
{
const char * str = "123";
charPtrToInt(str);
return 0;
}
But the conversion from const char* to long long is being accomplished by a reinterpret_cast<long long>, not a static_cast<long long>. If you try to substitute in the static_cast, the code fails to compile.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working