__declspec(align(32))
struct Str1{
int a, b, c, d, e;
};
#pragma data_seg("share_data")
int a = 0;
int b;
#pragma data_seg() __declspec(allocate("share_data")) int c = 1;
__declspec(allocate("share_data")) int d;
#define MY_TEXT "function is deprecated"
void func1(void) {}
__declspec(deprecated) void func1(int) { printf("func1n");}
__declspec(deprecated("** this is a deprecated function **")) void func2(int) { printf("func2n");}
__declspec(deprecated(MY_TEXT)) void func3(int) { printf("func3");}
int main()
{
fun1();
fun2();
fun3();
}
class ___declspec(dllexport)
testdll{
testdll(){};
~testdll(){};
};
调用客户端中声明
#import comment(lib, "**.lib)
class ___declspec(dllimportt)
testdll{
testdll(){};
~testdll(){};
};
template<class t>
class test{
test(){};
~test(){};
}
调用客户端中声明
int main()
{
test< int > b;
return 0;
}
__declspec ( naked ) func()
{
int i;
int j;
__asm /* prolog */
{
push ebp
mov ebp, esp
sub esp, __LOCAL_SIZE
}
/* Function body */
__asm /* epilog */
{
mov esp, ebp
pop ebp
ret
}
}
#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);
multiply(a, b, c);
}
#define WINAPI __declspec(nothrow) __stdcall void WINAPI f1(); void __declspec(nothrow) __stdcall f2(); void __stdcall f3() throw();
#if _MSC_VER >= 1100 && !defined(_DEBUG)
#define AFX_NOVTABLE __declspec(novtable)
#else
#define AFX_NOVTABLE
#endif
....
class AFX_NOVTABLE CObject
{
...
};
#include <stdio.h>
struct __declspec(novtable) X
{
virtual void mf();
};
struct Y : public X
{
void mf()
{
printf_s("In Yn");
}
};
class test
{
public:
static int t;
};
__declspec(selectany) int test::t = 0;
__declspec(thread)
class X{
public:
int I;
} x; // x is a thread objectX y; // y is not a thread object
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有