自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(127)
  • 资源 (1)
  • 收藏
  • 关注

原创 代码构建 premake4 例子

Building the Source Code//构建代码Premake can be built in either "release" (the default) or "debug" modes. If you are using Makefiles (as opposed to an IDE), you can choose which configuration to build with the config argument://构建模式 1.release版本 2.debug版本

2020-05-29 14:33:27 667

原创 gdb调试或者打印地址时候为啥只有48位?

例如:0x7fffd2f48c10根本原因:当前的x86_64处理器硬件限制所致。因为目前面世的x86_64处理器的地址线只有48条,硬件要求传入的地址的48到63位必须与47位相同。因为这个相同的原因也就是说剩下的16位要那么是 0x0000 要么是0xffff 也就是说情况1(剩下的16位都是0):BIN二进制64位是 0000 0000 0000 0000 0000 0000 000...

2019-11-06 15:08:02 750

原创 字符串化操作符#得作用

#include <stdio.h>#define f(a, b) a##b#define g(a) #a#define h(a) g(a)int main(){ printf("%s\n", h(f(1,2))); printf("%s\n", g(f(1,2))); return 0;}//考察字符串化操作符#得作用得执行过...

2019-11-05 17:28:15 745

原创 shell脚本批量创建删除账号

#!/bin/bashUSERS_INFO=/root/addusers.txtUSERADD=/usr/sbin/useraddUSERDEL=/usr/sbin/userdelPASSWD=/usr/bin/passwdCUT=/bin/cutwhile read LINESdo USERNAME=`echo $LINES | $CUT -f1 -d' '` ...

2019-09-24 17:58:28 425

原创 位操作实现m的n次方

#include <stdio.h>#include <stdlib.h>int pow(int m, int n){ int sum = 1; while(n != 0) { if(n&1 == 1) { sum *= m; } m *= m;...

2019-09-16 14:44:02 448

原创 C++ new map erase delete 不delete时候重复使用问题 各种情况测试代码

#include <iostream>#include <map>using namespace std;#include <stdio.h>struct A{ int x; int y; A(int v1, int v2) : x(v1), y(v2) {}};class B{ public:/*...

2019-06-18 15:55:50 1264

原创 go语言 面向对象 面向过程举例解释

package mainimport "fmt"type intt int //面向对象func (a intt) less(b intt) bool { return a > b }//面向过程func intt_less(a intt, b intt) bool { return a > b }func main() { var...

2019-04-17 17:08:01 608

原创 c signal函数与system函数小应用

#include&lt;sys/types.h&gt;#include&lt;iostream&gt;#include&lt;stdio.h&gt;#include&lt;stdlib.h&gt;#include&lt;errno.h&gt;#include&lt;unistd.h&gt;#include&lt;fcntl.h&gt;#include&lt;string.h

2019-01-22 14:40:33 382 1

原创 C++ 实际项目中设置全局变量三种方法

#include&lt;iostream&gt;using namespace std;#include&lt;stdlib.h&gt;#include&lt;stdio.h&gt;/** method one *****/template&lt;typename T&gt;class Singleton{ public: static T&amp; Instance(...

2019-01-11 18:21:22 5837

原创 C++ template模版长期举例总结

example_1#include&lt;iostream&gt;using namespace std;#include&lt;stdio.h&gt;template&lt;typename T&gt;class ID{ public: ID() : a(0) {} T getA() { return a;} void setA(T a_) { ...

2019-01-10 11:39:19 245

原创 C++ vector resize 后 之前保存数据是否清除(不清除)的测试用例

#include &lt;iostream&gt;using namespace std;#include&lt;vector&gt;#include&lt;stdio.h&gt;int main(){ std::vector&lt;int&gt; a; a.push_back(10); a.push_back(10); if(a.size() &l...

2019-01-07 17:55:30 5852

原创 #if #if defined #if !defined #elif defined #else #elif !defined #ifndef #define

#if __WORDSIZE == 64typedef long int __quad_t;typedef unsigned long int __u_quad_t;#elif defined __GLIBC_HAVE_LONG_LONG__extension__ typedef long long int __quad_t;__extension__ typedef unsigned...

2019-01-02 14:18:45 6840

翻译 C 中 ptrdiff_t简单思考举例

#include&lt;stdio.h&gt;#include&lt;stddef.h&gt;struct stuff{ char name[16];};typedef struct stuff STF;STF array[] = { {"12"}, {"122"}, {"123"}, {"12s"}, {"12x"}, {"132

2018-12-26 15:33:35 329

原创 extern "C" 与 __cplusplus 安全使用

无意中看源码看到的代码风格 如果已经宏定义 __cplusplus 则加入extern "C" 文件目录为/usr/include/event2/http_struct.h#ifndef _EVENT2_HTTP_STRUCT_H_#define _EVENT2_HTTP_STRUCT_H_/** @file event2/http_struct.h Data structure...

2018-12-25 20:20:45 154

原创 C++ map 覆盖 前后插入比较 前数据被覆盖

#include&lt;iostream&gt;#include&lt;map&gt;#include &lt;stdio.h&gt;using namespace std;int main(){ std::map&lt;int, int&gt; a; std::map&lt;int, int&gt; b; a.insert(std::make_pair(1...

2018-12-20 11:43:14 1996

原创 函数指针的两个简单用法

/************************************************************************* &gt; File Name: func.cpp &gt; Author: yangjx &gt; Mail: [email protected] &gt; Created Time: Sat 15 Dec 2018 12:28:19 PM C...

2018-12-15 13:17:50 152

原创 VBS excel 导出生成lua文件

Class TaskDesc public id public name public typeTask public klass public state public frd public reqLev public taskPre1 public taskPre2 public taskPre3 public taskPre4 public taskPre5 pub...

2018-04-02 11:43:22 352

原创 C++ 转换函数举例

#include&lt;iostream&gt;#include&lt;vector&gt;using namespace std;class A{ public: A(int a, int b) : a(a), b(b) {} inline int operator &lt;&lt;(int c) { return a + c;} inline oper...

2018-04-02 11:41:35 254

翻译 临时和永久关闭Selinux

临时关闭:[root@localhost ~]# getenforceEnforcing[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive永久关闭:[root@localhost ~]# vim /etc/sysconfig/selinuxSELINUX

2018-01-08 22:29:35 147402 3

原创 centos7.2安装 Redmine 3.4.3-2 (64-bit) Bitnami Redmine Installer

1.下载地址:https://bitnami.com/redirect/to/170722/bitnami-redmine-3.4.3-2-linux-x64-installer.run2.安装修改bitnami-redmine-3.4.3-2-linux-x64-installer.run 权限为可执行执行bitnami-redmine-3.4.3-2-linux-x64-ins

2018-01-04 12:01:49 2294 2

原创 典型进程表里保存的数据

2017-12-20 14:39:47 219

原创 存储器的速度

2017-12-19 14:02:50 1544

原创 用户态 内核态

2017-12-18 17:37:30 188

翻译 C++ explicit关键字

首先, C++中的explicit关键字只能用于修饰只有一个参数的类构造函数, 它的作用是表明该构造函数是显示的, 而非隐式的, 跟它相对应的另一个关键字是implicit, 意思是隐藏的,类构造函数默认情况下即声明为implicit(隐式).#include #include #include using namespace std;class A{ publi

2017-12-06 17:44:46 148

原创 C++中的mutable关键字

#include using namespace std;class A{ public: A() { count = 0; } ~A() {} void Out() const { std::cout << "ttttt" << std

2017-12-06 17:11:01 134

翻译 centos ONBOOT 为啥设置yes原因

ONBOOT是指明在系统启动时是否激活网卡,只有在激活状态的网卡才能去连接网络,进行网络通讯

2017-11-29 23:36:55 13227

翻译 析构函数声明为私有的作用

当我们规定类只能在堆上分配内存时,就可以将析构函数声明为私有的。class alloc{public:    alloc():private:   ~alloc();}; 如果在栈上分配空间,类在离开作用域时会调用析构函数释放空间,此时无法调用私有的析构函数。如果在堆上分配空间,只有在delete时才会调用析构函数。

2017-11-28 18:59:43 988

转载 centos 7 网卡命名新的规则 和之前不一样

CentOS6之前基于传统的命名方式如:eth1,eth0....Centos7提供了不同的命名规则,默认是基于固件、拓扑、位置信息来分配。这样做的优点是命名是全自动的、可预知的,缺点是比eth0、wlan0更难读。比如enp5s0一、网卡命名的策略systemd对网络设备的命名方式规则1:如果Firmware或者BIOS提供的设备索引信息可用就用此命名

2017-11-27 23:25:24 1136

原创 函数指针的简单举例

#include using namespace std;void A(int a, int b){ std::cout << "AAA:" <<a << " " << b << std::endl;}void B(int a){ std::cout << "BBB:" <<a << std::endl;}typedef void (*FUNC_A)(int

2017-11-20 17:52:30 313

原创 C++ 指针 new delete 赋值各种情况总结

#includeusing namespace std;int main(){ int* a = new int(100); std::cout << *a << " " << a << std::endl; //情况1 普通变量b /* * 结果 * 100 0x440f010 * 100 0x7fff6ff320d4

2017-08-02 11:16:36 2182

原创 模版 基类 父类 指针 正确保存数据

#include#include#includeusing namespace std;struct A{ int a; A():a(0) {} A(int ta) : a(ta) {}};struct AA:public A{ int aa; AA():A(), aa(0) {} AA(int ta, int taa): A(ta), aa(taa) {}};

2017-07-26 17:33:40 317

原创 C++ cant appear in a constant-expression bug修复

例:class KK{public:    template    void GetA()    {          A s;    }};int main(){    int a = 14;    KK s;    s.GetA();}会报 a cant appear in a constant-expressio

2017-07-06 20:39:03 5370

原创 MySQL 远程登录 和遇到问题解决

大体思路:MySQL本地 设置允许远程登录信息(包括IP地址等)本地重启远程连接问题:在Linux下安装MySQL,默认情况下只允许本地localhost或者127.0.0.1地址访问mysql,用IP地址访问mysql数据库时,会出现无法连接的错误。ERROR 1045 (28000): Access denied for user 'root'@'192.168

2017-06-17 10:07:49 342

原创 fork函数与I/O函数之间的交互关系

UINX环境高级编程 第三版#includeint globvar =6; char buf[] = "a write to stdout\n";int main(void){ int var; pid_t pid; var = 88; if(write(STDOUT_FILENO, buf, sizeof(buf)-1) != size

2017-06-01 22:45:25 268

原创 C++ 迭代器 it返回的内容以指针方式返回

#includeusing namespace std;#includeclass A{ public: int* GetA(int b) { for(std::vector::iterator it = _a.begin(); it != _a.end(); ++it) {

2017-03-13 11:21:39 5520

原创 C++ template简单应用

#includeusing namespace std;#includetemplateclass A{ private: T a;};templateclass A1 : public A{ private: V a1;};template, typename V = int>class B{ public

2017-03-09 14:45:54 326

原创 C++ 容器 new 删除问题

#include#includeusing namespace std;int main(){ std::vector a; int* b = new int(10); a.push_back(b); for(std::vector::iterator it = a.begin(); it != a.end();) { std::

2017-03-07 09:33:18 808

原创 C++ 基类 派生类 互相转换 调用关系

#includeusing namespace std;class A{ public: A(int a) : _a(a ) { std::cout << "this is A" << _a << std::endl; } void GetA() { std::cout << "get a" << std::endl; } public: int _a;

2017-03-04 01:04:49 434

翻译 C++11 auto_ptr shared_ptr unique_ptr

转自: http://blog.csdn.net/xiejingfa/article/details/50750037             http://jingyan.baidu.com/article/9f7e7ec0b785ae6f281554f6.html                  http://blog.csdn.net/xiamentingtao/article/d

2017-02-21 19:21:03 283

原创 C++ shared_ptr 编译 error ‘shared_ptr’ was not declared in this scope修复

#include#include#include#includeusing namespace std;class Simple{ public: Simple(int p = 0) { number = p; std::cout << "Simple::" << number << st

2017-02-21 10:36:16 11164

GTK跨平台语音识别系统

基于GTK跨平台语音识别系统,主要实现语音的分析和合成等功能

2013-11-14

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除