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 :)
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
2 comments:
sizeof(X)
Reply DeletePointer arithmetic :), displacement of sizeof(X) still acts as pointer.
Reply Delete(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 :)