#include<iostream>
#include<stdlib.h>
#include<assert.h>
usingnamespacestd;
classString
{
public:
String(constchar*str)
:_str(newchar[strlen(str)+1])
{
_size=strlen(str);
_capacity=_size+1;
strcpy(_str,str);
}
String(constString&s)
:..
分类:
编程语言 时间:
2016-01-27 17:41:22
阅读次数:
237
#include<iostream>
#include<stdlib.h>
#include<assert.h>
usingnamespacestd;
classString
{
public:
String(constchar*str)
:_str(newchar[strlen(str)+1])
{
_size=strlen(str);
_capacity=_size+1;
strcpy(_str,str);
}
String(constString&s)
:..
分类:
编程语言 时间:
2016-01-27 17:40:55
阅读次数:
197
#include<iostream>
#include<stdlib.h>
#include<assert.h>
usingnamespacestd;
classString
{
public:
String(constchar*str)
:_str(newchar[strlen(str)+1])
{
_size=strlen(str);
_capacity=_size+1;
strcpy(_str,str);
}
String(constString&s)
:..
分类:
编程语言 时间:
2016-01-27 17:39:34
阅读次数:
185
我们知道C语言有一个库函数atoi(表示alphanumerictointeger)是把字符串转换成整型数的一个函数。那么如何实现这个函数呢?很多同学很快会写出下列代码:intStrtoInt(charstr[])
{
assert(str);
intnum=0;
while(*str)
{
num=num*10+*str-‘0‘;
++str;
}
returnnum;
}这..
分类:
编程语言 时间:
2016-01-26 01:50:35
阅读次数:
165
一、编译安装过程优化1、减小Nginx编译后的文件大小在编译Nginx时,默认以debug模式进行,而在debug模式下会插入很多跟踪和ASSERT之类的信息,编译完成后,一个Nginx要有好几兆字节。而在编译前取消Nginx的debug模式,编译完成后Nginx只有几百千字节。因此可以在编译之前,...
分类:
其他好文 时间:
2016-01-23 10:27:36
阅读次数:
324
在调试程序时,经常会用到assert和printf之类的函数,我最近做的这个工程里就有几百个assert,在你自认为程序已经没有bug的时候,就要除去这些调试代码,应为系统在正常运行时这些用于调试的信息是无用的,而且会占用时间和空间。怎么删除呢,俺以前都是用笨方法,一个一个注释,能用注释也是经过改进...
分类:
编程语言 时间:
2016-01-23 00:53:36
阅读次数:
211
#pragmaonce
#include<stdio.h>
#include<string.h>
#include<assert.h>
#include<stdlib.h>
typedefintDataType;
//定义一个结构体类型
typedefstructLinkNode
{
DataTypedata;//定义节点的数据
structLinkNode*next;//保存下一个类型节点的地址
}..
分类:
其他好文 时间:
2016-01-21 15:56:21
阅读次数:
113
断言:也就是所谓的assertion,是jdk1.4后加入的新功能。它主要使用在代码开发和测试时期,用于对某些关键数据的判断,如果这个关键数据不是你程序所预期的数据,程序就提出警告或退出。当软件正式发布后,可以取消断言部分的代码。java中使用assert作为断言的一个关键字,这就可以看出java对...
分类:
编程语言 时间:
2016-01-21 10:24:25
阅读次数:
208
#define_CRT_SECURE_NO_WARNINGS1
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<string.h>
#defineMAX_SIZE5
typedefintDataType;
typedefstructSeqList
{
size_tsize;
DataTypearray[MAX_SIZE];
}SeqList;
//冒泡排序
//v..
分类:
编程语言 时间:
2016-01-18 20:59:01
阅读次数:
302
#define_CRT_SECURE_NO_WARNINGS1
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<string.h>
#defineMAX_SIZE5
typedefintDataType;
typedefstructSeqList
{
size_tsize;
DataTypearray[MAX_SIZE];
}SeqList;
//voidInitSeqLis..
分类:
编程语言 时间:
2016-01-18 20:55:58
阅读次数:
250