Jump Tables via Function Pointer Arrays in C/C++
来源:互联网 发布:光晕守护者和人工智能 编辑:程序博客网 时间:2024/05/26 02:54
by Nigel Jones
=================================================================================================================
Jump tables, also called branch tables, are an efficient means of handling similar events in software. Here's a look at the use of arrays of function pointers in C/C++ as jump tables.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Examination of assembly language code that has been crafted by an expert will usually reveal extensive use of function "branch tables." Branch tables (a.k.a., jump tables) are used because they offer a unique blend of compactness and execution speed, particularly on microprocessors that support indexed addressing. When one examines typical C/C++ code, however, the branch table (i.e., an array of funtion pointers) is a much rarer beast. The purpose of this article is to examine why branch tables are not used by C/C++ programmers and to make the case for their extensive use. Real world examples of their use are included.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
更多请参考阅读: http://www.barrgroup.com/Embedded-Systems/How-To/C-Function-Pointers
..............................................................................................................................................................................................................................................................
- Jump Tables via Function Pointer Arrays in C/C++
- Mad Pointer in C
- Pointer in C/C++
- Windows Via C/C++: The CreateProcess function
- deeply understand pointer in C
- void pointer assignment in C
- one trick in C pointer.
- const and pointer in c
- array and pointer in c
- Pointer that points to function (C)
- C Programming Language: Function Pointer Array Study
- C函数指针应用之转移表(jump tables)
- c pointer
- memcached.c: In function ‘add_iov’:
- The function that returns the pointer (C Programming)
- C Pointer-to-Function 与 C++ Pointer-to-MemberFunction 的区别
- C++Arrays
- Function Pointer of class member function C++的类成员函数指针简要
- SDCC大会有感
- 今天机试,希望不大
- SACC 2012 第三天
- 写时复制
- 【面试题】全排列
- Jump Tables via Function Pointer Arrays in C/C++
- 关于sizeof和strlen !!!
- hdu2486 hdu2580 poj3922 A simple stone game--K倍动态减法游戏 博弈
- 2012记录整理
- [poj] 1042 Gone Fishing
- [poj] 1700 Crossing River
- 深度挖掘打井来-----STUDENTMIS
- java小练习(控制台输出猜一个数,有猜大猜小提示 )
- 2012中兴软件笔试 回忆录