C++
iteye_14490
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
undefined reference to `wxColour::IsOk() const'
CXXFLAGS多了一个参数-fvisibility-inlines-hidden的原因,这个参数是以前在望上看的能够加速编译的原创 2009-11-20 16:51:38 · 169 阅读 · 0 评论 -
多维pointer 如何free
free 的方法与之前如何 alloc的相关。 * 如果之前是 一次alloc(例如:指向一个二维数组 char ** p = new char arr[3][3]), 那么申请的一整块连续的heap space, 那么应该也只有一个manage structor, 所以只需要free 一次(即set manage structor 中的availiable flag = 1)...2009-04-25 20:26:58 · 149 阅读 · 0 评论 -
when string passing as parameter(const)
It means when you hold the point that point "XXXX", you * Can not modify the content * Can not free it2009-04-25 20:28:55 · 154 阅读 · 0 评论 -
about malloc
做了一个调用malloc 分配memory 的小程序.执行之后,top/ ps -A -o pcpu,pmem,cmd发现memory 没有分配。在malloc 后面添加 memset ,memory 才被分配2009-04-25 20:33:17 · 129 阅读 · 0 评论 -
Error: No rule to make target XXX
在Src 目录下new 几个新的目录和文件,Make 就出现上面的Error 了。〔问题原因〕应该是在Make的过程中没有找到 指定的file。〔解决方法〕可以在Makefile.am 或者 Makefile 中 加入 VPATH(搜索path)例如:VPATH = base utils engineer...2009-04-25 20:44:47 · 258 阅读 · 0 评论 -
函数的声明 (Too Much Default Visibility)
函数的使用范围应该得到最大程度的限制,而不是default 的 globle。如果不想 global ,就应该在前面加上static (only 在本源文件中使用)#这个以前没有注意到#参考来源 deep c secrets# Too Much Default Visibility...原创 2009-04-25 20:47:15 · 125 阅读 · 0 评论 -
return value of GTK callback function
False:如果你想在你的Callback 之后继续把signal 传递给system继续处理True:如果你想到此为止(不再把signal 传递给system继续处理)2009-04-25 20:47:47 · 123 阅读 · 0 评论 -
全局静态变量 global static variable
全局静态变量与 全局变量的区别在于全局静态变量只能在被本源文件中使用。[header.h]static int i = 0;void setStatic();[s1.c]#include #include "header.h"int main(int argc, char *argv[]){setStatic();printf("%d %...2009-04-25 20:49:35 · 522 阅读 · 0 评论 -
negative mod
(-10) % 3 = ?(-10) - (3* -4) = 2原创 2009-07-27 17:59:20 · 148 阅读 · 0 评论 -
关于 #include 的位置
是放在*.h or *.c 里面? * 如果是*.h 的内容要用到#include,就需要放到*.h里面 * 否则,放到*.c2009-04-25 20:26:21 · 280 阅读 · 0 评论 -
c++ 编译问题
一个简单的vector 的c++ 程序, 编译错误#include int main(){std::vector vet;}错误原因:使用的gcc 命令(应该使用g++命令)gcc :“GCC” is a common shorthand term for the GNU Compiler Collection. This is both...2009-04-25 20:25:29 · 167 阅读 · 0 评论 -
伪随机数 pseudo random number
C 语言中的 srand 和 rand * Why “伪”随机数?因为rand() 产生的随机数并非真正的随机数,而是通过同余算法根据srand()中的参数seed来产生的序列数中的一个。In others word, 同样的seed产生出来的序列数是一样的。这也是Why "srand()" 要放在Loop外的原因。(即使是用time(0)作Seed,在Loop内产生...2009-04-25 15:48:28 · 224 阅读 · 0 评论 -
Pass by reference
C++ 中 函数的参数传递时,如果数据量比较大,即使是没有打算修改参数的值,出于性能(速度)方面的考虑,也应该采用 采用 Pass by reference 的方式。另外,建议在函数的参数声明时,前面加上“const” 明示。...2009-04-25 15:50:43 · 140 阅读 · 0 评论 -
pointer 使用时注意事项
使用pointer前一定要先确认其值是否为0if (!p)特例: delete 的时候不需要2009-04-25 15:51:37 · 217 阅读 · 0 评论 -
build-in 变量的初始化
如果是 file scope的build-in 变量会被初始化为0如果是local scope的build-in 变量,除非程序员指定,否则不会被初始化2009-04-25 15:52:23 · 169 阅读 · 0 评论 -
函数参数的 Default value
与 ANSI C 不同,C++的函数参数可以有Default Value。但在by ref的情况下,应该声明为pointer 而非一个referance ,因为pointer可以设定default value 为0两个规则 1. 最右规则 2. 函数声明处定义default value...2009-04-25 15:53:27 · 501 阅读 · 0 评论 -
inline 声明
inline only 是对complier一种请求,complier 并不一定执行。适合声明为inline的函数的特点:体积小,经常被调用inline函数的定义(并非声明)需要放在头文件中...2009-04-25 15:54:17 · 210 阅读 · 0 评论 -
errir: request for member 'XXX' in 'YYY'. which is
错误的原因好像有两种1.http://groups.google.com/group/comp.lang.c++/browse_thread/thread/165fd677062f0d132.http://cplusplus.syntaxerrors.info/index.php?title=Request_for_member_%E2%80%98bar%E2%80...原创 2009-04-25 20:23:06 · 595 阅读 · 0 评论 -
关于二维指针的初始化
一个初级的问题:char *a; char **arr, **firstPos;a = (char *) malloc(8);strcpy(a,"123");arr = & a;firstPos = arr;arr ++;a = (char *) malloc(8);strcpy(a,"456");arr = & a;...2009-04-25 20:23:50 · 423 阅读 · 0 评论 -
unsigned signed cast
unsigned 和 signed 一起运算时, signed 会 cast 为 unsigned -1 > 0U (unsigned 0)原创 2009-07-27 18:03:20 · 269 阅读 · 0 评论
分享