- 博客(16)
- 资源 (1)
- 收藏
- 关注
转载 Thread Safety of shared_ptr
shared_ptr objects offer the same level of thread safety as built-in types. Ashared_ptr instance can be "read" (accessed using only const operations) simultaneously by multiple threads. Differents
2015-05-30 16:51:54 776
原创 使用 shared_ptr
shared_ptr是一個模板類,它保存了一個指向動態分配的對象的指針,當指向這個對象的最後一個shared_ptr被銷燬的時候,這個對象也被銷燬了。有三種使用 shared_ptr的方法:1)使用 std::shared_ptr要用 std::shared_ptr的方式使用。實例代碼:#include #include class A{public: A()
2015-05-30 16:40:54 1543
转载 Stack Types and Instructions
The ARM supports four different stack implementations. These are categorised by two axes, namely Ascending versus Descending and Empty versus Full.An Ascending stack grows upwards. It starts from a
2015-05-28 07:20:26 744
原创 ARM上函数调用参数超过四个的时传递方法
众所周知,ARM架构下,函数参数是通过 r0~r4寄存器传递的;但是如果参数超过四个,就要借助于栈了。下面以一个例子说明。int func(int a1, int a2, int a3, int a4, int a5, int a6){ return a1 + a2 + a3 + a4 + a5;}int main(void){ func(1, 2, 3, 4, 5, 6);
2015-05-28 07:13:31 12160 4
转载 Using GIOChannel
http://www.symlab.org/main/documentation/reference/s3/pdk/GUID-817C43E8-9169-4750-818B-B431D138D71A.htmlGIOChannel provides a portable method for using file descriptors,sockets and pipes and int
2015-05-26 03:26:02 1294
原创 GLIB main event loop
下面是一个小程序,其实是一个简单的事件触发模型:#include #include #include GMainLoop *loop;gboolean callback(GIOChannel *channel){ gchar *str; gsize len; /*stdin*/ g_io_channel_read_line(channel, &st
2015-05-26 03:06:06 1189
原创 查看 pkg-config默认的搜索路径
pkg-config --variable pc_path pkg-config输出结果是:/usr/local/lib/i386-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/sh
2015-05-25 07:02:11 7559 2
原创 编译 EFL代码时的一个错误
在编译 EFL(https://www.enlightenment.org/download)代码,执行 config时,报错:configure: error: pkg-config missing openssl但是openssl 已经安装了:$ dpkg --get-selections | grep openssllibgnutls-openssl27:i386 inst
2015-05-22 05:54:59 1814
转载 A Brief intro to X11 Programming
A Brief intro to X11 ProgrammingThis is meant to be a simple overview of X11 programming. It will contain the basics necessary to create a single window X program. All of the information of this w
2015-05-20 07:22:53 1201
转载 An Introduction to OpenCL Programming
Benedict R. Gaster (AMD Architect) has published on AMD developers website, an introduction to OpenCL programming.I repoduced the complete source code here without the comment (you have to jump to
2015-05-20 07:17:04 898
原创 当debug信息单独存放为一个文件时使用gdb调试CoreDump
为了便于开发,现在经常把可执行文件里的debug信息取出来单独作为一个文件,这样,可以使得可执行文件体积变小很多。比如,rpm包普遍采用这样的方法。这种情况下,如果要对产生的 coredump进行调试,需要做一些特殊的设置。下面以一个简单的例子来说明这种方法。1. 先写几个测试文件:$ cat lib1.c #include void fun1(void){ printf
2015-05-16 13:39:18 2615
原创 Bash shell脚本打印出正在执行的命令
默认情况下,bash脚本不会打印执行的每个命令,这个有时候不太方面。如下的方法可以让bash脚本打印出执行的命令:1) 在脚本里添加 set -v 或者 #!/bin/bash -v以加 set -v 最好。set -v 和set -o verbose是一样的2) 添加set -x 或者#!/bin/bash -x3,
2015-05-16 12:41:12 37202
转载 算法分析: Longest Common Subsequence
LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order, but not necessarily con
2015-05-10 13:32:36 886
原创 编译器优化对函数的影响
编译器如gcc,可以指定不同的优化参数,在某些条件下,有些函数可能会被优化掉。先写一个简单的测试文件: cat test.c inline void foo(void){}用命令gcc -g -c test.c编译成目标文件。用 nm检查函数符号:$ nm -C test.o 00000000 T foo现在使用 命令gcc -g -c -O2 t
2015-05-08 04:16:27 1460
原创 算法分析: 求最长的递增数列
求最长的递增数列(Longest Increasing sequence, LIS)是一个比较常见的问题。给定数列 10, 22, 9, 33, 21, 50, 41, 60, 80,那么 LIS 为 10, 22, 33, 50, 60, 80分析思路: 假定 array[0, ..n-1]为输入数据, LIS[i]为array[0, ...i-1]时的LIS (i >0, i
2015-05-08 04:00:14 1788
原创 算法问题分析--邮票问题
问题如下:There are N number kinds of stamps with different worth. At this moment, you are allowed to use the same kinds of stamps several times, but the total number of uses of all stamps is restricted
2015-05-02 18:32:39 3772
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人