發表文章

目前顯示的是有「gcc」標籤的文章

Is it possible to store the address of a label in a variable and use goto to jump to it?

http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html https://stackoverflow.com/questions/6421433/address-of-labels-msvc gcc有,MSVC不支援 只想拿來給switch case用 與其用enum存再switch,不如直接存address用goto,或許會稍微快一點? 沒研究過CPU branch prediction和indirect branch怎麼做的,無法確定 function pointer也能達成類似的效果,可是function call cost應該比較高