`
文章列表
C++编码中减少内存缺陷的方法和工具 编程技术 2010-03-26 12:37:26 阅读45 评论0   字号:大中小 订阅 摘 要:基于C++的软件的缺陷和错误大部分都和内存相关,预防、发现、消除代码中和内存相关的缺陷,成为程序员编写、调试、维护代码时的重要任务。该文基于“面向网络海量空间信息的大型GIS”课题的工程实践,提出和总结了如何使用C++语言机制、开发环境和相关质量保证工具来预防、发现各种编译期、运行期内存缺陷的方法和工具。关键词:C++;内存错误;内存泄漏;质量保证Techniques and Tools of Defending Memory-r ...
发现在子函数中的申请的动态内存数组赋值a[i]=b,其中i为负数,当时不会保存,因为动态内存寻址是可以找到-1,-2之类的地址的,但是破坏了可能破环其他的代码运行,当时的现象是_CrtDumpMemoryLeaks函数打印不出子函数之外的内存分配请,而在赋值之前是可以打印函数外面申请的内存情况的。   教训:发现内存崩溃,先利用工具检测,锁定范围,在寻找内存错误!
这是在vs2005环境下出现的错误! 解决方法: 1,在你的项目属性里面把编码方式改为"使用多字节字符集" 2把代码改成这样的形式_T("insert into MasterInfo (EditTime,GSMCCN,GSMCEN,CLSJ,FRDBCN,FRDBEN,POSTCODE,") 宽字符   本人用第一种方法顺利解决!  

设置word背景颜色

 
如何设置word背景颜色缓解眼睛疲劳 设置方法: 桌面->右键->属性->外观->高级->项目选择(窗口)、颜色1(L)选择(其它)将色调改为:85。饱和度:123。亮度...
DispatchMessage <script></script><script type="text/javascript"></script>   函数功能:该函数分发一个消息给窗口程序。通常消息从GetMessage函数获得。消息被分发到回调函数(过程函数),作用是消息传递给操作系统,然后操作系统去调用我们的回调函数,也就是说我们在窗体的过程函数中处理消息   函数原型:LONG DispatchMessage(CONST MSG*lpmsg);   参数:   lpmsg:指向含有消息的MSG结构的指针。   返 ...
TranslateMessage <script></script><script type="text/javascript"></script> 目录 基本信息 参数 <script type="text/javascript"></script> 编辑本段基本信息   函数功能:该函数将虚拟键消息转换为 ...
PostQuitMessage <script></script><script type="text/javascript"></script>   函数功能:该函数向系统表明有个线程有终止请求。通常用来响应WM_DESTROY消息。   函数原型:VOID PostQuitMessage(int nExitCode);   参数:   nExitCode:指定应用程序退出代码。此值被用作消息WM_QUIT的wParam参数。   返回值:无。   备注:PostQuitMessage寄送一个WM_QUIT消息给线程的 ...

人应该自主

    博客分类:
  • job
不要飘,不要笨,不要受人影响!
void Convert(double BMWL,double NORMAL,double *BMwindowVct,float *RR,int * rR,int lenz,double *RRproc){ double *X=NULL; double *Y=NULL; if (NULL==X) {  X=new double[BMWL];  } if (NULL==Y) {  Y=new double[NORMAL]; }  for(int i=0;i<BMWL;i++) {  X[i]=BMwindowVct[i]; }  for(int i=0;i<NORMAL;i++)  ...
void fft(COMPLEX *x, int m){   COMPLEX *w;           /* used to store the w complex array */  int mstore = 0;       /* stores m for future reference */  int n = 1;            /* length of fft stored for future */  COMPLEX u,temp,tm; COMPLEX *xi,*xip,*xj,*wptr;  int i,j,k,l,le,windex;  double arg, ...
void PolyfitCf(int n_poly,int Nwin_length,int Npoly,double * ypoly,double **fitcoef){ int i,j,m; int nwin_length=Nwin_length; int poly_n=n_poly; int npoly=Npoly;  double *x=NULL;//[nwin_length]; if (x==NULL) {  x=new double[nwin_length]; }  for (int ix=0;ix<nwin_length;ix++) {  x[i ...
 rstime[0]=ORTIME[0]; rsvalue[0]=ORVALUE[0]; int rst=1; int rsv=1; int ornum=lengthlrs; if (resampfz!=0&&ornum>=1) {  double addtime=(double)1/(resampfz);  double lineReSampleX[2];  double lineReSampleY[2];  lineReSampleX[0]=0;  lineReSampleX[1]=0;  lineReSampleY[0]=0;  lineReSampleY[1]=0; ...
首先到www.zlib.net 下载个ZLIB,解压缩后打开zlib-1.2.3\projects\visualc6\zlib.dsw 选择Win32 LIB Release 按F7编绎生成zlib.lib 工程中使用时把 D:\zlib-1.2.3\projects\visualc6\Win32_LIB_Release\zlib.lib D:\zlib-1.2.3\zlib.h D:\zlib-1.2.3\zconf.h 拷贝到所在工程目录下 然后 #include "zlib.h"#pragma comment(lib,"zlib.lib&quo ...
内存查看方法: 头文件加入: #include <windows.h>#define _CRTDBG_MAP_ALLOC#define USING_LEAK_CHECK    1  #ifndef _crtdbg_map_alloc  #define _crtdbg_map_alloc  #endif   #include <stdlib.h>  #if USING_LEAK_CHECK  #include <crtdbg.h>  #endif  #include <stdi ...
// TimeTest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <windows.h>#include <cmath>#include <ctime> #include <stdio.h>#include<time.h>#include "math.h" //计算给定的时间是本年的第几秒int count(int year,int month,int day,int hour,int minter,int second){int i,s ...
Global site tag (gtag.js) - Google Analytics