随笔分类 - C/C++
摘要:1.KURL:it's the type of String in WTF,we use[html]view plaincopyKURL.string().utf8().data();to return the char * in the KURL.And how does it come out? a KURL is defined in WebCore/Platform/KURL.h, it has a member function string(). b KURL.string(), return a class of String, which was defined in
阅读全文
摘要:1、二叉排序树二叉排序树是这样一棵树a.空树b.1)如果左子树不空,左子树的所有节点的值小于其根节点的值2)如果右子树不空,右子树所有节点的值大于其根节点的值3)其左右子树都是二叉排序树2、遍历对于拥有指针next的数据结构,遍历的时候,一般都是以指针p作为游标进行遍历一般有2种方式判断游标p是否到尽头a p==NULLb p->next==NULLb的好处是遍历条件结束后,p依然指向最后一个有效节点,但是初始的时候,要对p进行非空判断。3、查找查找一般有几种目的a 简单查找只为获取一个节点的值。b 查找并且删除,一般这种情况下,不但要获取该节点的指针,还要获取该节点的前驱节点。c 查找
阅读全文
摘要:c++.static&const1.staticstatic change the field and the life circlea. variable with static in the file, this variable could only used in this file.b. variable with static in the function, the variable will exist till then program end rather then the end of the function.c. variable with static in
阅读全文
摘要:1.const as "const variable" 2.function parameters together with "&" int add(int &a);//can be modified int add(const int &a);//can't be modified //but more efficient than int add(int a); no value copy 3.override function int add(); int add() const; //different func
阅读全文
摘要:1. interrupt flowHardware->Interrupt Controller->Processor2.Interrupt Handlera. DefinitionThe function that the kernel runs, in response to a specific interrupt.b.Difference between other kernel function.Kernel invoke them.the run in a special context.c.Interrupt handle's jobAcknowledge th
阅读全文
摘要:Set, Data structure which does not allow duplicate elements. Map.Entry, is a key/value mapping contained in a Map. Map, is a data structure consisting of a set of keys and values in which each key is mapped to a single value. Collection, is the root of the collection hierarchy. It defines operations
阅读全文
摘要:for code copy in the futuresimple server and clientmay be useful for copy in the futureserver:[cpp] view plaincopy#include<errno.h>#include"sys/types.h"#include"sys/socket.h"#include"sys/stat.h"#include"unistd.h"#include<netinet/in.h>//#include<
阅读全文
摘要:1. definitionlong ptrace(int request, pid_t pid, void * addr, void * data)request , trace type;the request determine the meaning of the other parameters and return value.2.possibility of request[cpp] view plaincopy#definePTRACE_TRACEME0#definePTRACE_PEEKTEXT1#definePTRACE_PEEKDATA2#definePTRACE_PEEK
阅读全文
摘要:socket API原本是为网络通讯设计的,但后来在socket的框架上发展出一种IPC机制,就是UNIX Domain Socket。虽然网络socket也可用于同一台主机的进程间通讯(通过loopback地址127.0.0.1),但是UNIX Domain Socket用于IPC更有效率:不需要经过网络协议栈,不需要打包拆包、计算校验和、维护序号和应答等,只是将应用层数据从一个进程拷贝到另一个进程。 这是因为,IPC机制本质上是可靠的通讯,而网络协议是为不可靠的通讯设计的。UNIX Domain Socket也提供面向流和面向数据包两种API接口,类似于TCP和UDP,但是面向消息的UNI
阅读全文
摘要:Android use UNIX Domain Socket for get debug log.usually name "tombstone_0X" and so on in /data/log/logcat/1. ServerFirst , it has a socket server. it's a executable program.The code was in "system/core/debuggerd/debuggerd.c"in the main, it open a IPC socket[cpp] view plainco
阅读全文
摘要:exec is used for start another program in the c code of linux1.execl[cpp] view plaincopyintexecl(constchar*path,constchar*arg,...)the last parameter must end up with NULL.[cpp] view plaincopy#include<stdio.h>#include<unistd.h>intmain(){execl("/home/cascais/code/hello","hel
阅读全文

浙公网安备 33010602011771号