易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

Oracle 语句级触发器

先构造一个表:
create table emp2(
id number(2),
name varchar(10),
currdate date,
action varchar2(1)
)
创建触发器:
create or replace trigger d_i_u_emp2
after insert or update or delete on mysort
begin
if inserting then
insert into emp2 values (12,'dog',sysdate,'i');
elsif deleting then
insert into emp2 values (12,'dog',sysdate,'d');
elsif updating then
insert into emp2 values (12,'dog',sysdate,'u');
end if;
end;
语句级的不涉及到数据完整性的问题,只要做相应的语句动作就会触发,与行无关,无论多少行只要做了这个动作就触发!
替换触发器只能建在视图上面 ......

几种C/C++的函数压栈方式

一,不同关键字,系统压栈方式
1,如果函数func是__cdecl(VC下的默认调用方式),调用时情况如下
int main()
{
//参数从右到左压栈
push 4
push 3
push 2
push 1
call func
add esp 0x10 //调用者恢复堆栈指针esp,4个参数的大小是0x10(4x4)
}
C调用约定(即用__cdecl关键字说明)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参数的函数只能使用该调用约定)。另外,在函数名修饰约定方面也有所不同。
_cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。VC将函数编译后会在函数名前面加上下划线前缀。是MFC缺省调用约定
2.如果函数func是__stdcall,调用时情况如下
int main()
{
//参数从右到左压栈
push 4
push 3
push 2
push 1
call func
//恢复堆栈指针由被调用者func负责,方法是"ret 0x10"
}
_stdcall是Pascal程序的缺省调用方式,通常用于Win32 Api中,函数采用从右到左的压栈方式,自己在退出时清空堆栈。VC将函数编译后会在函数名 ......

几种C/C++的函数压栈方式

一,不同关键字,系统压栈方式
1,如果函数func是__cdecl(VC下的默认调用方式),调用时情况如下
int main()
{
//参数从右到左压栈
push 4
push 3
push 2
push 1
call func
add esp 0x10 //调用者恢复堆栈指针esp,4个参数的大小是0x10(4x4)
}
C调用约定(即用__cdecl关键字说明)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参数的函数只能使用该调用约定)。另外,在函数名修饰约定方面也有所不同。
_cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。VC将函数编译后会在函数名前面加上下划线前缀。是MFC缺省调用约定
2.如果函数func是__stdcall,调用时情况如下
int main()
{
//参数从右到左压栈
push 4
push 3
push 2
push 1
call func
//恢复堆栈指针由被调用者func负责,方法是"ret 0x10"
}
_stdcall是Pascal程序的缺省调用方式,通常用于Win32 Api中,函数采用从右到左的压栈方式,自己在退出时清空堆栈。VC将函数编译后会在函数名 ......

C/C++/Java for语句规范写法浅析(二重及以上循环)

 举个简单例子:用二重循环输出1-100 数字;
 当然我这里是举例子针对二重及以上的循环,
完全可以使用单循环,于是便飞快的完成了以下
 代码:
  如下就用C/C++举例。
 C++代码(VS2008):
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
    int i = 0;
    int j = 0;
    int count = 0;
    cout<<"Run Result:"<< endl;
    for (;i<10;i++)
    {
        for (;j<10;j++)
        {
            count++;
            cout<< "\t"<< count<<endl;
        }
    }
    return 0;
}
 
  Run Result:
        ......

C/C++/Java for语句规范写法浅析(二重及以上循环)

 举个简单例子:用二重循环输出1-100 数字;
 当然我这里是举例子针对二重及以上的循环,
完全可以使用单循环,于是便飞快的完成了以下
 代码:
  如下就用C/C++举例。
 C++代码(VS2008):
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
    int i = 0;
    int j = 0;
    int count = 0;
    cout<<"Run Result:"<< endl;
    for (;i<10;i++)
    {
        for (;j<10;j++)
        {
            count++;
            cout<< "\t"<< count<<endl;
        }
    }
    return 0;
}
 
  Run Result:
        ......

C/C++/Java for语句规范写法浅析(二重及以上循环)

 举个简单例子:用二重循环输出1-100 数字;
 当然我这里是举例子针对二重及以上的循环,
完全可以使用单循环,于是便飞快的完成了以下
 代码:
  如下就用C/C++举例。
 C++代码(VS2008):
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
    int i = 0;
    int j = 0;
    int count = 0;
    cout<<"Run Result:"<< endl;
    for (;i<10;i++)
    {
        for (;j<10;j++)
        {
            count++;
            cout<< "\t"<< count<<endl;
        }
    }
    return 0;
}
 
  Run Result:
        ......

C 语言数据对齐

#include <stdio.h>    
struct Foo1
{
   char a;
   int  b;
   char c;
   int  d;
};
#pragma pack (2)
struct Foo2
{
   char a;
   int  b;
   char c;
   int  d;
};
#pragma pack ()
struct Foo3
{
   char a;
   char c;
   int  b;
   int  d;
};
struct Foo4
{
   char a;
   int  b;
   char c;
   int  d;
} __attribute__ ((__packed__));
int main(int argc, char **argv)
{
   printf("size of Foo1: %d ", sizeof(struct Foo1));
   printf("size of Foo2: %d ", sizeof(struct Foo2));
   printf("size of Foo3: %d ", sizeof(struct Foo3));
   printf("size of Foo4: %d ", sizeof(struct Foo4));
   return 0;
}
下面的小程序是关于数据对齐的一个试验,在我的 2.4 内核的 Linux 上运行结果如下:
size of Foo ......

c/c++的知识点收集

1.动态获得内存的代码:
void GetMemory(char **p, int num)
{
  *p = (char *)malloc(sizeof(char) * num);
}
char* GetMemory2(int num)
{
  char* p = (char *)malloc(sizeof(char) * num);
  return p;
}
------------------------------------------
错误的代码:
void GetMemory3(char *p, int num)
{
  p = (char *)malloc(sizeof(char) * num);
}///////////////错误在哪里,我就不说,自己去查.
2.strcpy()的代码:
char* strcpy(char* strDest,const char* strSrc)
{
    if(strDest==NULL || strSrc==NULL)      return NULL;
    char* pStr=strDest;
    while((*strDest++=*strSrc++)!='\0)
          NULL;
    return pStr; 
}
3.memcpy()的代码:
void* memcpy(char* strDest,const char* strSrc,size_t size)
{
    if(strDest==NULL||strSrc==NULL) return NULL;
    if(size <=0) return NULL;   
    ......

c/c++的知识点收集

1.动态获得内存的代码:
void GetMemory(char **p, int num)
{
  *p = (char *)malloc(sizeof(char) * num);
}
char* GetMemory2(int num)
{
  char* p = (char *)malloc(sizeof(char) * num);
  return p;
}
------------------------------------------
错误的代码:
void GetMemory3(char *p, int num)
{
  p = (char *)malloc(sizeof(char) * num);
}///////////////错误在哪里,我就不说,自己去查.
2.strcpy()的代码:
char* strcpy(char* strDest,const char* strSrc)
{
    if(strDest==NULL || strSrc==NULL)      return NULL;
    char* pStr=strDest;
    while((*strDest++=*strSrc++)!='\0)
          NULL;
    return pStr; 
}
3.memcpy()的代码:
void* memcpy(char* strDest,const char* strSrc,size_t size)
{
    if(strDest==NULL||strSrc==NULL) return NULL;
    if(size <=0) return NULL;   
    ......

从函数返回一个数组的2种方法 (C专家编程 p230)

严格来说,无法从函数返回一个数组,但可以从函数返回一个指向任何数据结构的指针,包括一个指向数组的指针。
一种方式如下:
#include <stdio.h>
#include <stdlib.h>
int (*func())[20];//func是一个函数,它返回一个指向包括20个int元素的数组的指针
int main(void)
{
        int (*result)[20];
        int i = 0;
        result = func();
        for(i = 0; i < 20; i++){
                printf("%d\n", (*result)[i]);
        }
        free(result);
        exit(0);
}
int (*func())[20]
{
        int (*a)[20];
        int i = 0;
   ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [6302] [6303] [6304] [6305] 6306 [6307] [6308] [6309] [6310] [6311]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号