
C++
qq_35536179
这个作者很懒,什么都没留下…
展开
-
弱符号与强符号
目标文件中的符号在链接中,将函数和变量统称为符号,函数名和变量名就是符号名。ELF文件中符号表的符号分类:1. 定义在本目标文件的全局符号,可以被其他目标文件引用;2. 本目标文件中引用的全局符号,却没有定义在本目标文件中;3. 段名,这种符号一般由编译器产生,它的值就是该段的起始地址4. 局部符号5. 行号信息,即目标文件指令与源代码中代码行的对应关系,它是可选的弱符号与强符号对于C/C++语言来说,编译器默认函数和初始化了的全局变量为强符号,未初始化的全局变量为弱符号原创 2022-03-27 23:12:23 · 467 阅读 · 0 评论 -
C语言的模块化编程思想
变量声明与定义判断规则: 1. 如果省略了extern且具有初始化语句,则为定义语句。如int i = 10; 2. 如果使用了extern,无初始化语句,则为声明语句。如extern int i; 3.如果省略了extern且无初始化语句,则为试探性定义。如int i;头文件的搜索路径: 1. <>包含头文件 (1) 通过GCC参数gcc -I指定的目录 ...原创 2021-09-21 18:44:49 · 1171 阅读 · 0 评论 -
背包问题之方案
#include <iostream>#include <vector>#include <algorithm>using namespace std;//计算01背包问题,价值最大的方案数int getNumberOfSchemes(vector<int>& goodsVolume,vector<int>& goodsValue, int packetSize) { int n = goodsValue.siz.原创 2021-09-05 21:15:02 · 129 阅读 · 0 评论 -
KMP算法:模板字符串中包含几个指定的字符串
class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 计算模板串S在文本串T中出现了多少次 * @param S string字符串 模板串 * @param T string字符串 文本串 * @return int整型 */ int kmp(string S, string T) { // write code .原创 2021-09-05 00:38:31 · 119 阅读 · 0 评论 -
C++ std::async()函数的使用
/*** @author jsq* @date 20210613* @function: 学习std::future模板类、std::async()、std::packaged_task()模板类、std::promise()模板类的使用* @notice:*/#include <iostream>#include <thread>#include <vector>#include <list>#include <mutex>.原创 2021-06-15 14:37:23 · 676 阅读 · 0 评论 -
C++ 条件变量类的学习
/*** @author jsq* @date 20210613* @function: 1.练习使用condition_variables类* 2.练习使用wait()成员函数* 3.练习使用notify_one()成员函数* @notice:* 1. 如果notify_one()唤醒时,另外的线程没有卡在wait()处,则该次唤醒失效*/#include <iostream>#include <thread>#include <vec.原创 2021-06-13 18:57:32 · 106 阅读 · 0 评论 -
C++ 创建多线程单例对象
#include <iostream>#include <thread>#include <vector>#include <list>#include <mutex>using namespace std;class MySigleton {public: // 借用call_once()创建单例对象 static void CreateInstance() { instance = new MySigleto.原创 2021-06-12 16:02:00 · 374 阅读 · 0 评论