DL : 20
		
优化C++程序编译效率的实例
(1)自定义程序的入口
(2)合并区段
(3)不用调malloc,free等函数
(3)不用cout来输出,cin来输入
(4)如果调用了很多库函数如memset,stycpy等等
的话,请导入msvcrt.lib,不然编译器会在程序里面
导入静态库,这样的话程序就会大很多。。
(5)........
减少程序运行内存占用量可以调用
SetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
 
Date : 2009-02-10
Size : 5.67kb
User : newviews
			
	
		
						DL : 0
		
VC++ 封装了队列类 /// /// /// ///// //this a example for using Queue ///////////////////////////////////////// #include "Queue.h" //define queue data struct struct QueueData { 	char data[20] 	int nId } //define queue typedef TQueue<QueueData> TMyQueue //put data into queue { 	QueueData data 	memset(&data, 0, sizeof(data)) 	strcpy(data.data, "hello!") 	data.nId = 0 	m_pMyQueue.TryPut(data) } //try put data into queue { 	QueueData data 	memset(&data, 0, sizeof(data)) 	strcpy(data.data, "hello!") 	data.nId = 0 	if(m_pMyQueue.TryPut(data) != 0) 	{ 		MessageBox("put queue error") 	} 	else 	{ 		MessageBox("put queue success") 	}	 } //get data from queue { 	QueueData data 	memset(&data, 0, sizeof(data)) 	m_pMyQueue.Get(data) 	MessageBox(data.data) 	 } //try get data from queue { 	QueueData data 	memset(&data, 0, sizeof(data)) 	m_pMyQueue.TryGet(data) 	MessageBox(data.data) 	 }-cohort of VC Packaging category /////////////////////////////////////////// this is a example for using Queue /////////////////////////////////////////# include "Queue . h "//define queue data struct QueueData struct (char data [20] int nId)// define queue typedef TQueuelt; QueueDatagt; TMyQueue// put data into QueueData data queue (memset (data, 0, sizeof (data)) htpasswd (data.data, "hello!") data.nId m_pMyQueue.TryPut = 0 (data))// try put data into QueueData data queue (memset (data, 0, sizeof (data)) htpasswd (data. data, "hello!") data.nId = 0 if (m_pMyQueue.TryPut (data)! = 0) (MessageBox ( "put queue error")) else (MessageBox ( "put queue success")))// get data from QueueData data queue (memset (data, 0, sizeof (data))  
Date : 2025-11-01
Size : 33kb
User : zj
			
	
		
						DL : 0
		
memset,memcpy和strcpy-memset, memcpy and htpasswd 
Date : 2025-11-01
Size : 1kb
User : zxk
			
	
		
						DL : 0
		
iccavr编译器下的源代码,一共有两个部分,这是第二个部分-iccavr the compiler source code, a total of two parts, this is the second part 
Date : 2025-11-01
Size : 28kb
User : 把儿
			
	
		
						DL : 0
		
	wince 自带的DB数据库编译,由CEDBUse修改下,主要是修改了编译通不过,通过后操作不正常,还有验证在MIPS和ARM分别完成数据库操作(增加,删除,修改) 一开始本人以为自带的数据库只支持四列,原来不是指这个意思而是指4种索引!所以在本源码里已经在表里加入了五列数据!
主要包含文件:
CEDBUseDlg.cpp
CEDBUseDlg.h
StudentInputDlg.cpp
StudentInputDlg.h
CEDBUse.cpp
CEDBUse.h
注意与原版不同的 //memset(pProps,0,LocalSize(pProps)) 最被注释掉
因为第二次分配内存时会导致本程序出错,注释掉不影响操作-wince s own DB database compiled by the modifications under CEDBUse mainly modify the compiler pass, however, after the passage of abnormal operation, as well as verification in the MIPS and ARM, respectively, to complete the database operations (add, delete, modify) the very beginning I thought that since with the database only supports 4, the original was not referring to the meaning of but four kinds of index! Therefore, in this source in the exterior has joined the five data! main include file: CEDBUseDlg.cppCEDBUseDlg.hStudentInputDlg.cppStudentInputDlg.hCEDBUse.cppCEDBUse . h attention with different original// memset (pProps, 0, LocalSize (pProps)) commented out the most because the allocation of memory when the second would lead to this error, comment out does not affect the operation 
Date : 2025-11-01
Size : 51kb
User : lzy
			
	
		
						DL : 0
		
主要源码:
void CFDlg::OnChangeEdit1() 
{
 UpdateData() 
 m_strExt.MakeUpper() 
 m_list.ResetContent() 
 if(m_strExt.GetLength()==0) return 
 
 
 CStdioFile sf 
 if(sf.Open("FileExt.txt",Cfile::modeRead))
 { 
 CString strTemp,strOut 
 
 while(sf.ReadString(strTemp))
 { 
 if(strTemp.Left(m_strExt.GetLength()) ==m_strExt)
 { 
 m_list.AddString(strTemp) 
 } 
 }
 }
 sf.Close() 
 
 m_list.SetCurSel(0) 
 this->OnSelchangeList2() 
}
 
void CFDlg::OnSelchangeList2() 
{
 CString strTemp,strExt 
 m_list.GetText(m_list.GetCurSel(),strTemp) 
 strExt=strTemp.Left(strTemp.FindOneOf(" ")) //MessageBox(strExt) 
 
 CString strFileName ="eee."+strExt //MessageBox(strFileName) 
 SHFILEINFO shfi 
 memset(&shfi,0,sizeof(shfi)) //或者ZeroMemory(&shfi,sizeof(shfi)) 
 ::SHGetFileInfo(strFileName,
 FILE_ATTRIBUTE_NORMAL,
 &shfi,
 sizeof(shfi),
 SHGFI_ICON|SHGFI_USEFILEATTRIBUTES) 
 m_icon.SetIcon(shfi.hIcon) 
}-Main source: void CFDlg:: OnChangeEdit1 () (UpdateData () m_strExt.MakeUpper () m_list.ResetContent () if (m_strExt.GetLength () == 0) return CStdioFile sf if (sf.Open (FileExt.txt, Cfile :: modeRead)) (CString strTemp, strOut while (sf.ReadString (strTemp)) (if (strTemp.Left (m_strExt.GetLength ()) == m_strExt) (m_list.AddString (strTemp)))) sf.Close ( ) m_list.SetCurSel (0) this- 
Date : 2025-11-01
Size : 40kb
User : HUGH RENNY
			
	
		
						DL : 1
		
 srand[getpid[]] 
 /* initialize some of the memory */
 memset[heightmap, 0, MAPSIZE*MAPSIZE] 
 memset[vpage, 0, RENDERWIDTH * RENDERHEIGHT] 
 printf["Creating dx d fractal terrain\n", MAPSIZE, MAPSIZE] 
 heightmap[0] = [rand[] 128] + 64 // initialize starting point on map
 CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] 
 printf["Smoothing terrain\n"] 
 for [i = 0 i < 5 i++]
 SmoothMap[] 
 MakeColorMap[] -  srand[getpid[]] 
  /* initialize some of the memory*/
  memset[heightmap, 0, MAPSIZE*MAPSIZE] 
  memset[vpage, 0, RENDERWIDTH* RENDERHEIGHT] 
  printf["Creating  dx d fractal terrain\n", MAPSIZE, MAPSIZE] 
  heightmap[0] = [rand[]   128]+ 64    // initialize starting point on map
  CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] 
  printf["Smoothing terrain\n"] 
  for [i = 0  i < 5  i++]
    SmoothMap[] 
  MakeColorMap[]  
Date : 2025-11-01
Size : 4kb
User : xrgj
			
	
		
						DL : 0
		
 srand[getpid[]] 
 /* initialize some of the memory */
 memset[heightmap, 0, MAPSIZE*MAPSIZE] 
 memset[vpage, 0, RENDERWIDTH * RENDERHEIGHT] 
 printf["Creating dx d fractal terrain\n", MAPSIZE, MAPSIZE] 
 heightmap[0] = [rand[] 128] + 64 // initialize starting point on map
 CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] 
 printf["Smoothing terrain\n"] 
 for [i = 0 i < 5 i++]
 SmoothMap[] 
 MakeColorMap[] -  srand[getpid[]] 
  /* initialize some of the memory*/
  memset[heightmap, 0, MAPSIZE*MAPSIZE] 
  memset[vpage, 0, RENDERWIDTH* RENDERHEIGHT] 
  printf["Creating  dx d fractal terrain\n", MAPSIZE, MAPSIZE] 
  heightmap[0] = [rand[]   128]+ 64    // initialize starting point on map
  CreateFractalMap[0, 0, MAPSIZE, MAPSIZE] 
  printf["Smoothing terrain\n"] 
  for [i = 0  i < 5  i++]
    SmoothMap[] 
  MakeColorMap[]  
Date : 2025-11-01
Size : 11kb
User : xrgj
			
	
		
						DL : 0
		
代码检查工具 只要简单一些switch case的配对 以及类里面memset的使用,防止盖了虚表-A simple code inspection tool switch case some type of matching, as well as the use of memset inside to prevent the cover of the virtual table 
Date : 2025-11-01
Size : 232kb
User : lionline
			
	
		
						DL : 0
		
在网上能够找到的最简单,最快速的哈夫曼编码。本方法不使用任何扩展动态库,比如STL或者组件。只使用简单的C函数,比如:memset,memmove,qsort,malloc,realloc和memcpy。-Online to find the simplest, fastest Huffman. This method does not use any extension of the dynamic libraries, such as STL or components. Only using a simple C function, such as: memset, memmove, qsort, malloc, realloc and memcpy. 
Date : 2025-11-01
Size : 14kb
User : zhaoyibin
			
	
		
						DL : 0
		
本文描述在网上能够找到的最简单,最快速的哈夫曼编码。本方法不使用任何扩展动态库,比如STL或者组件。只使用简单的C函数,比如:memset,memmove,qsort,malloc,realloc和memcpy。
大家都会发现,理解甚至修改这个编码都很容易-This article describes the Internet to find the simplest, fastest Huffman. This method does not use any extension of the dynamic libraries, such as STL or components. Only using a simple C function, such as: memset, memmove, qsort, malloc, realloc and memcpy. We will find, understand and even modify the code easily 
Date : 2025-11-01
Size : 142kb
User : 李虚东
			
	
		
						DL : 0
		
本文描述在网上能够找到的最简单,最快速的哈夫曼编码。本方法不使用任何扩展动态库,比如STL或者组件。只使用简单的C函数,比如:memset,memmove,qsort,malloc,realloc和memcpy。
-This article describes the Internet can find the simplest, most fast Huffman coding. This method does not use any extension dynamic libraries, such as STL or component. Using only a simple C function, for example: memset, memmove, qsort, malloc, realloc, and memcpy. 
Date : 2025-11-01
Size : 13kb
User : mxb
			
	
		
						DL : 0
		
Memset、Memcpy、Strcpy 的作用和区别-Memset, Memcpy, Strcpy distinction between the role and 
Date : 2025-11-01
Size : 6kb
User : ready
			
	
		
						DL : 0
		
memset: Simple memory set in various ways for Linux v2.13.6.
 
Date : 2025-11-01
Size : 2kb
User : dingherrai
			
	
		
						DL : 0
		
Most apps use memset sanely. Memsetting about 3.4 bytes or less get penalized here compared to the generic implementation Source Code for Linux.
 
Date : 2025-11-01
Size : 3kb
User : puiwivd
			
	
		
						DL : 0
		
在linux环境下memset()函数简单的宏,可以学习用-In the Linux environment memset () function simple macros, can learn to use 
Date : 2025-11-01
Size : 3kb
User : 柏胜
	
 
 
	 
 
 
 
	
		
			CodeBus is one of the largest source code repositories on the Internet!
 
            Contact us : 
			1999-2046 
CodeBus All Rights Reserved.