5 ms·
> Also the above will not compile. It compiled for me (after changing NULL to nullptr). > Because compilers can actually detect if you set a pointer to nullpt
by heinrich5991 2y ago
> Also the above will not compile.
It compiled for me (after changing NULL to nullptr).
> Because compilers can actually detect if you set a pointer to nullptr and then use it.
Apparently it didn't.
> Here, you didn't use it so maybe the compiler won't complain. But in the general case yes it will complain.
That's incorrect, there's a use of the nullptr.
> You call some unsafe code that directly interacts with memory.
I don't see something explicitly declared as unsafe from the source code alone. It looks like a normal pointer dereference to me.
- consteval 2y ago> That's incorrect, there's a use of the nullptr No, there isn't. > declared unsafe Please, I have no patience for the purposefully obtuse. It's clear I was referring to other languages there. Which, you failed to address. Probably because it was difficult, so you figured if you just said "I'm right" and elaborated nothing nobody would notice. Sorry, that doesn't work on people who are awake. As I've said, you can argue that C++ is weakly typed but you MUST also address languages like C# and Java to make that argument. You haven't, so nobody will believe you when you say C++ is weakly typed.