编程语言
文章平均质量分 75
sumoyu
这个作者很懒,什么都没留下…
展开
-
lua调c动态库
Lua脚本调c动态库函数时开始调不成功,通过Lua官方的Mail List才知道:c动态库里的注册函数和Lua脚本的打开库的方式要一致。1.c动态库的代码:static int lua_msgbox(lua_State* L){ const char* message = luaL_checkstring(L, 1); const char* caption原创 2008-06-24 14:02:00 · 1829 阅读 · 1 评论 -
Deep copy and shadow copy
When copying a class instance to another,we think about the deep copy and shadow copy. If just assiging tha value to each class data member and ignoring resource reallocation (if there are resoures, s原创 2010-08-10 16:07:00 · 944 阅读 · 0 评论 -
类相互引用
a.hclass A;class B{ public: int i; A a;}; class A{ public: int k; B b;};nest.cpp#include "A.h"int main(){ A a; B b; return 1;}A error "field `a原创 2010-06-23 09:55:00 · 399 阅读 · 0 评论 -
Lua 与C交互
Lua和C之间的交互(一) Lua调C函数 1. 什么样类型的函数可以被Lua调用 typedef int (*lua_CFunction) (lua_State *L); 2. 符合类型的函数怎样处理后才可以被Lua调用使用lua_register或者 lua_pushfunction和lua原创 2008-06-27 18:15:00 · 11990 阅读 · 5 评论 -
虚函数表博文总结
对虚函数实现方式的理解:1.每个有虚函数的类都有虚函数表,记录了继承的虚函数、自己重载的虚函数的地址。2.多重继承时,有多个虚函数表,每继承一个父类产生一个虚函数表。3.构造函数构造对象时,在对象所在内存的首地址放置虚函数表的地址;如果这个类有多个虚函数表就放置多个虚函数表的地址。4.虚函数表是在编译时生成的。如果某个类,在程序中就没有被使用,也就是没有实例化类,那么这个类的虚表就转载 2012-04-17 15:33:39 · 633 阅读 · 0 评论 -
Shell脚本中的文件名扩展和判断条件中的空格
要从server库里下载一些文件,就写脚本。在写的过程中遇到两个问题。1. 文件名扩展#!/bin/shA="core"if [ "$A" == c* ];then echo "OK"fi运行脚本时,报错“[: too many arguments”。查了网上的一些资料知道是文件名扩展(File globbing)的原因。运行脚本的目录下有这样几个文件:cmd原创 2012-06-11 18:09:16 · 906 阅读 · 0 评论 -
Improper Publish
There is an example in > 3.5 which demonstrates improper publish.public class Holder{ private int n; public Holder(int n){this.n = n;} public void assertSanity(){ if(n !=原创 2014-06-18 09:29:13 · 652 阅读 · 0 评论