易截截图软件、单文件、免安装、纯绿色、仅160KB

Optimizing Your C/C++ Applications


C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick  
Share |
6/21/2004 
 
Sidebar: Know the Code
A code profiler can help determine which parts of your application should be optimized. You should always use a profiler both before and after optimization to see if your change actually made an improvement—with C/C++, you can never be sure if your hand-tuning methods are better than those of your optimizing compiler!
The smart engineers at AMD have spent a lot of time identifying places where C/C++ developers can optimize code for best performance. Some of these optimizations might look familiar—they're generally great coding practice for any 32-bit or 64-bit platform or operating system. In fact, most of these suggestions are appropriate whether you're developing 32-bit or 64-bit apps. Others are specifically for 64-bit applications running on the AMD64 architecture. This article will look at six optimizations; Part 2 will examine eight more.
#1. Declare as static functions that are not used outside the file where they are defined
Declaring a function as static forces an internal linkage within that file, which can improve the performance of the code. Functions that are not declared as static default to external linkage, which may inhibit certain optimizations, such as aggressive inlining, with some C/C++ compilers.
#2: Use array notation instead of pointer notation when working with arrays
You can use either array operators ([]) or pointers to access the elements of an array. However, it's hard for the compiler to optimize pointers because the pointers are, by default, less constrained—the compiler has to assume that the pointer can read/write to any location in memory. Because array nota


相关文档:

规范化的C++编程方法备忘录 C/C++算数运算:

    已经知道的,不说了...大家都知道的,可以问问,查查资料。这里又放些附加建议:
1.基本算数运算:
  既然计算机里没有真正的整数,那么计算机里也没有真正的算数运算。
    取值范围:
  设a和b是两个占一样位宽的无符号整数,这种整数可取到最大值M ......

C 语言二维数组和双重指针

#include "Stdio.h"
#include "Conio.h"
#include
#define size 81
#define lim 5
#define tstr "ABCDEFGH"
void display(char **p,int i);
void display2(char *p[],int i);
void display3(char (*p)[40],int i);
void testint();
int main(void)
{
testint();
getch();
return 0;
}
test1() ......

C/C++: 十六进制转10进制源码 收藏

C/C++: 十六进制转10进制源码
收藏



view plain
copy to clipboard
print
?
int
 hex_char_value(
char
 c)  
{  
    if
(c >= 
'0'
 && ......

(windows下)用Eclipse搭建C/C++开发环境

--------如果你用的是或打算用Eclipse For C++,那么从这里看,
1. 首先下载Eclipse for C++, 最新版是基于Eclipse 3.5.2的,eclipse-cpp-galileo-SR2-win32.zip
2. 解压,直接运行。注意,至少JDK你已经安装了(我用的是JDK1.6)。运行后welcome页面出现,进入Tutorials。先读Tutorial是个好习惯。
3. 首先 什么是CDT... ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号