文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > c++ 中__declspec 的用法
侵权投诉

c++ 中__declspec 的用法

c++ 中__declspec 的用法

其实这两个关键字就是给编译器了一种保证,编译器信任他就不在进行一些检查操作了。

e.g

#include <stdio.h>

#include <stdlib.h>

#define M 800#define N 600#define P 700float * mempool, * memptr;

__declspec(restrict) float * ma(int size)

{

float * retval;

retval = memptr;

memptr += size;

return retval;

}

__declspec(restrict) float * init(int m, int n)

{

float * a;

int i, j;

int k=1;

a = ma(m * n);

if (!a) exit(1);

for (i=0; i<m; i++)

for (j=0; j<n; j++)

a[i*n+j] = 0.1/k++;

return a;

}

__declspec(noalias) void multiply(float * a, float * b, float * c)

{

int i, j, k;

for (j=0; j<P; j++)

for (i=0; i<M; i++)

for (k=0; k<N; k++)

c[i * P + j] = a[i * N + k] * b[k * P + j];

}

int main()

{

float * a, * b, * c;

mempool = (float *) malloc(sizeof(float) * (M*N + N*P + M*P));

if (!mempool)

puts("ERROR: Malloc returned null"); exit(1);

memptr = mempool;

a = init(M, N);

b = init(N, P);

c = init(M, P);

上一页第4页

你可能喜欢

热门文档

相关文档

  • __declspec关键字详细用法

    __declspec 关键字详细用法 __declspec 用于指定所给定类型的实例的与 ...在 C++中,默认情况下 const 为 static;但在 C 中是正确的,其默认情况下 ...

  • _declspec用法

    用法:__declspec ( extended-decl-modifier ) extended-decl-modifier 参数如下,...在 C++中,默认情况下 const 为 static; 但在 C 中是正确的,其默认情况下 ...

  • C++中 _declspec(novtable) 的探讨

    类的成员函数里调用虚函数需要 vtable 指针, 但是 class B 是不允许产生 ... c++ 中__declspec 的用法... 6页 免费 C语言中常用的三种排序方... 2页...

  • __declspec的详细用法

    __declspec 的详细用法 __declspec 用于指定所给定类型的实例的与 Microsoft ...在 C++中,默认情况下 const 为 static;但在 C 中是正确的, 其默认情况下 ...

  • C++中&的用法总结

    C++中&的用法总结_理学_高等教育_教育专区。C++中&的用法总结(例题详解哦)一种是按位与 1 & 2 = 0 一种是取地址 int* p = &a; 一种是声明引用,...

  • C++

    __declspec 关键字详细用法 2010-03-04 15:04 __declspec 用于指定所给定类型...在 C++中,默认情况下 const 为 static;但在 C 中是正确的,其默认情况下 ...

  • C++中new 的用法大全 详细

    C++编程技巧,模板特化、模板偏特化就更是技巧性很强的东西,STL 中的 type_traits 充分借助模板特化的功能,实现了在程序编译期通过编译器来决定为每一处调用使用哪...

  • __declspec关键字详细用法_李剑

    __declspec 关键字详细用法 ---李剑编辑 __declspec 用于指定所给定类型的实例...当然, 如果你 的 DLL 里全是 C++ 的类的话,你无法在 DEF 里指定导出的...

  • declspec关键字

    我要用。一般用于使用某个 dll 的 exe 中 不使用 __declspec(dllimport) ... __declspec 和 DLL导出函... 8页 免费 C++关键字 暂无评价 4页 免费 ...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email