精華區beta Programming 關於我們 聯絡資訊
※ 引述《txt.bbs@bbs.ntu.edu.tw (筆記本)》之銘言: > ==> tinlans.bbs@whshs.cs.nccu.edu.tw (汀) 提到: > > 「C++ 的所有 pointer 在 32-bit 平台上 size 一律是 32-bit」、 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 快 教大家一下 怎麼開不是 32 bits 的 pointer class member function pointer, 這是 C++ 特有的 function pointer, size 在大部分的 C++ 環境都是一般指標的兩倍, 這個 overhead 也算是 C++ 的常識之一, 不過很多教授不知道... #include <iostream> using namespace std; class X { void foo() { } }; int main() { void (X::*ptr)(void); cout << sizeof(ptr) << endl; return 0; } -- Name: Tseng, Ling-hua E-mail Address: uranus@it.muds.net School: National Chung Cheng University Department: Computer Science and Information Engineering Researching: Porting GCC and Implementing VLIW instruction scheduler in GCC Homepage: https://it.muds.net/~uranus -- ╔═══╗ ┼────────────────────────╮ 狂狷 Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮ 年少 ┼╮ < IP:140.119.164.16 > ╰─╮ ╚╦═╦╝ From:218-171-156-105.dynamic.hinet.net ─╨─╨─ KGBBS 遨翔"BBS"的狂狷不馴;屬於年少的輕狂色彩