Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
sizeof(X)
Pointer arithmetic :), displacement of sizeof(X) still acts as pointer.(unsigned)((X *) 0)+1) // sizeof(X)class X{public: display() { cout << "hi" }private: int gender;};((X *)(0))->display(); // won't touch X substrate (no runtime surprises)C++ is fun to play around :)
sizeof(X)
ReplyDeletePointer arithmetic :), displacement of sizeof(X) still acts as pointer.
ReplyDelete(unsigned)((X *) 0)+1) // sizeof(X)
class X
{
public:
display() { cout << "hi" }
private:
int gender;
};
((X *)(0))->display(); // won't touch X substrate (no runtime surprises)
C++ is fun to play around :)