
C/C++
文章平均质量分 57
牛仔好鬼忙
Hope is a good thing, maybe the best of things and no good thing ever dies!
展开
-
c++进阶学习计划
背景最近在项目中使用Python来解决问题,虽然好用,但是在关键性能模块就显得疲软,所以最近重温使用C++来开发,发现C++解决问题的方便程度虽然没有python来的这么顺手,但是通过自身不断发掘库与抽象共用函数,发现解决起来还是顺手,关键性能真的高 发现自己在C++研究还是需要加强.在外面世界语言竞争越趋向激烈的话,自己也需要增强自身的学习进阶书籍网上流传6E,也就是Effective C++,原创 2017-06-20 23:51:48 · 2505 阅读 · 0 评论 -
SEH结构异常处理使用
编译错误error C2712: Cannot use __try in functions that require object unwinding附录:SEH异常代码define in #define WAIT_IO_COMPLETION STATUS_USER_APC#define STILL_ACTIVE原创 2012-12-27 09:44:03 · 2603 阅读 · 0 评论 -
C#多线程实现方法——异步委托/调用
C#异步调用(Asynchronou Delegate)C#异步调用获取结果方法:主要有三种,也可以说是四种(官方说四种,电子书说三种),官方在MSDN上已经有详细的说明: 链接需要了解到获取异步执行的返回值,意味着你需要调用Delegate的BeginInvoke方法,而不是Invoke方法。第一种就是书上没有说的,但是官方还是给出来的,就是通过调用EndInvoke方法来获取内原创 2012-12-26 20:44:34 · 15396 阅读 · 4 评论 -
c++ stl 算法使用
associated container: setCompare between setsif you want to find the different elements in one set to another set, you could use the std::set_difference method int i = 0; set s1 = boost::as原创 2012-11-07 15:56:05 · 734 阅读 · 0 评论 -
Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径
环境变量设置/etc/profile:在登录时,操作系统定制用户环境时使用的第一个文件,此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。并从/etc/profile.d目录的配置文件中搜集shell的设置。/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取。~/.bash_profile:每个原创 2012-12-23 00:03:12 · 11781 阅读 · 2 评论 -
c++使用技巧: 不要在构造函数/析构函数中调用虚函数
构造函数中调用虚函数将会因为派生类没有完成自身的初始化,而使得只能调用基类的虚函数定义,如果基类没有给出虚函数的实现,则会编译出错时出错(LNK2019没有找到对应函数的实现)。析构函数中调用虚函数(同时需要保证基类析构函数是虚函数,否则删除基类指针将不会调用派生类得析构函数)。测试代码:class Base{public: Base() { cout<<"Base原创 2012-12-06 11:51:14 · 1061 阅读 · 0 评论 -
C++使用技巧:copy and swap idiom
Copy and Swap idiom使用到著名的Big three中兩個特殊的成員函數(拷貝構造函數copy construction與賦值構造函數assignment constrcution). 作用在于在深拷贝的过程中保证强异常的作用,具体代码如下class Person{public: Person(int id, const char * pszName):_id(i原创 2012-11-20 19:58:15 · 931 阅读 · 1 评论 -
C++ 元编程 Meta Programming
啊原创 2012-11-20 15:58:58 · 1117 阅读 · 0 评论 -
Windows开发实录
饭是一口一口吃的...预编译 PrecompilerCompiling C++ code is a long, slow process, especially compiling window API or other API library(boost).The Microsoft compiler can ameliorate this problem with a si原创 2012-11-17 14:07:30 · 487 阅读 · 0 评论 -
C++ Mac OS program
Mac XCode program1. Add additional header/librariesFor XCode project, add the "Header Search Paths" or "Library Search Paths" under "Search Paths" in xcodeproj.2. Add additional link flagsFor原创 2012-11-15 21:28:05 · 975 阅读 · 0 评论 -
C++ boost usage
Install BOOST1. Build from source codeDownload the new release package from boost official websiteFor windows, download zip or 7z format and unpack it using 7zip or winrarFor linux/mac os, dow原创 2012-11-15 08:55:43 · 876 阅读 · 0 评论 -
C++ windows multithread 多线程编程(一)
多线程编程使用createthread需要提供LPTHREAD_START_ROUTINE线程函数,线程函数的签名为 void (*) (void * lpParam)对于类静态函数或者全局函数,需要在LPTHREAD_START_ROUTINE强制定义ThreadProc类静态函数:需要(LPTHREAD_START_ROUTINE)Class::StaticFunction原创 2012-11-23 17:42:57 · 2435 阅读 · 0 评论 -
C++ Various String Types (char, wchar_t, string, wstring, cstring)
convert char * to wchar_t *using mbstowcs function char psz[] = {"helloworld\0"}; wchar_t pwsz [10] = {0}; int len = strlen(psz); int ret = mbstowcs(pwsz, psz, min(len, 10)); cout<<ret<<endl原创 2012-11-08 16:05:16 · 520 阅读 · 0 评论 -
C++ Macro Usage
Debug logSometimes we need to print some logs to show the application is running well during debug. But for release version, we choose to ignore these logs.So we can use macros to finish these fun原创 2012-11-08 12:56:15 · 1100 阅读 · 0 评论 -
boost library usage
1. download the boost library from the offical website.2. Unzip the file For windows, use 7zip for .7z file or use zip for .zip file. For ubuntu/linux/mac os x, use command: tar xjf boost_原创 2012-10-28 16:55:24 · 807 阅读 · 0 评论 -
分析IPMSG源代码
WinMain与mainWinMain的原型:int CALLBACK WinMain( __in HINSTANCE hInstance, __in HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nCmdShow);WinMain的定义:WinMain is the co原创 2013-01-03 14:20:07 · 2273 阅读 · 0 评论 -
内存泄露检查
Windows平台下的内存泄露使用CRTDBG#ifdef _DEBUG#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)#else#define DEBUG_CLIENTBLOCK#endif#define _CRTDBG_MAP_ALLOC#include #ifdef _DEBUG原创 2012-12-18 21:57:29 · 995 阅读 · 0 评论 -
c++ makefile中的应用
makefile中判断系统版本ARCH=$(shell getconf LONG_BIT)其中64位的操作系统是返回64,32位操作系统返回32原创 2015-01-16 18:48:31 · 593 阅读 · 0 评论 -
mysql c/c++语言程序开发
mysql c api 官方网站原创 2014-10-12 23:06:57 · 750 阅读 · 0 评论 -
linux c/c++ 动态库开发实例
windows中使用__declspec(dllexport)来将函数导出原创 2014-10-15 20:30:25 · 2572 阅读 · 0 评论 -
linux c/c++ 程序哪些事儿
源文件->目标文件gcc -E .c ->.i 预编译gcc -c .i -> .o原创 2014-10-15 18:45:18 · 542 阅读 · 0 评论 -
makefile 通配符与函数说明
makefile变量定义原创 2014-10-12 21:26:51 · 1161 阅读 · 0 评论 -
centos c++开发:访问数据库
1. 安装文章centos环境下c++开发环境搭建一文部署2.原创 2014-09-30 12:55:29 · 682 阅读 · 0 评论 -
mysql 使用c/c++程序开发
使用c/c++进行mysql的程序开发需要安装mysqlclient端windows用户到原创 2014-10-09 10:47:36 · 877 阅读 · 0 评论 -
centos下c++开发环境搭建
1. 安装gcc-c++, yum install gcc-c++,选择base仓库(何为仓库可以查看)2.原创 2014-09-30 14:22:22 · 9161 阅读 · 0 评论 -
windows下mingw与eclipse cdt的环境搭建
安装mingw编译器模拟gcc/g++原创 2014-10-08 12:34:15 · 608 阅读 · 0 评论 -
windows下mingw与codeblock环境下开发mysql
1. 安装codeblock2. 下载mysql-connector-c压缩包codeblock添加额外的头文件原创 2014-10-08 16:08:17 · 1272 阅读 · 0 评论 -
c++11新特性
std::inistializer_list使用inistializer_list能够初始化同一类型或者能够隐式转换成统一类型的函数形参,简化函数接口的实行,例如:double Sum(std::initializer_listli){ double sum = 0.0; for(auto p = li.begin(); p != li.end(); p++)原创 2012-12-18 14:36:23 · 537 阅读 · 0 评论 -
C++字符串/十进制/十六进制转化
ASCII字符串转16进制字符串(HEX字符串) string pp = "whoami"; string hex; for_each(pp.begin(), pp.end(), [&hex](char c){ char val[3] = {0}; sprintf(val, "%X", c); //小写则为%x hex.append(string(val)); });输出原创 2013-01-14 23:54:48 · 10610 阅读 · 1 评论 -
scanf, printf使用
scanf 格式int scanf( const char* format [,argument]... );int sscanf( const char *buffer, const char *format [, argument ] ... );format格式控制字符为%[*] [width] [{h | l | ll | I64 | L}]type其中有方括号原创 2013-01-14 22:40:14 · 891 阅读 · 0 评论 -
LoadLibrary和GetModuleHandle的区别
LoadLibrary是把一个模块映射进调用进程的地址空间,需要时增加引用计数,每调用一次,引用计数增加一,需要通过相同步骤地调用FreeLibrary来减少引用次数,当为0时,系统卸载DLL。HMODULE WINAPI LoadLibrary( __in LPCTSTR lpFileName);lpFileName 如果提供了路径(须使用backslashes(\),不要使用原创 2013-01-09 15:42:07 · 10885 阅读 · 0 评论 -
Operating System Version
methods1. GetVersion functionRetrieves the version number of the current operating system.Note This function has been superseded byGetVersionEx. New applications should useGetVersionEx o原创 2013-01-05 18:31:49 · 2310 阅读 · 0 评论 -
Ubuntu中MySQL使用
安装MySQL以及开发库sudo apt-get install mysql-server mysql-client libmysqlclient-dev libmysqlclient18 libmysql++-dev libmysql++3 libmysql++-docMySQL重要命令登录mysql后台mysql -uroot -p导入数据库mysql -uro原创 2012-12-20 22:45:49 · 3526 阅读 · 0 评论 -
NLS编程
NLS(National Language Support)Background(背景)Each language has a language name and a language identifierthat indicate the particular code page (ANSI, DOS, Macintosh) used to represent the geographi原创 2013-01-05 17:07:58 · 916 阅读 · 0 评论 -
命令行的使用
命令行命令列表:http://ss64.com/nt/例子1:@echo offset kobradir="C:\Program Files\Reuters\Kobra\Program"set kobra="kobra.exe"set kobraconfig="C:\Program Files\Reuters\Common\Config\RFA.RFA-con原创 2012-10-29 21:00:42 · 545 阅读 · 0 评论 -
integrate stlport with visual studio 2010
as far i writting this article, stlport's last version is 5.2.1.you will find this stlport is perfectly integrated with visual studio 2008原创 2011-09-10 22:00:15 · 420 阅读 · 0 评论 -
C语言运算符优先级
(转)优先级运算符名称或含义使用形式结合方向说明1[]数组下标数组名[常量表达式]左到右()圆括号(表达式)/函数名(形参表).成员选择(对象)对象.成员名原创 2010-05-26 16:05:00 · 411 阅读 · 0 评论