当前位置: 首页 > news >正文

绿色食品网站建设论文女教师遭网课入侵直播

绿色食品网站建设论文,女教师遭网课入侵直播,前几年做哪个网站致富,网站开发销售怎么做今天在公司的时候,排查一个问题,创建l3 lif 失败,查看各种日志发现是用key去创建的 lif失败了,日志里指示key为空,导致的创建失败。原因为一个结构体比基线的多了一些东西,导致版本不对,既而计算…

        今天在公司的时候,排查一个问题,创建l3 lif 失败,查看各种日志发现是用key去创建的 lif失败了,日志里指示key为空,导致的创建失败。原因为一个结构体比基线的多了一些东西,导致版本不对,既而计算出来的key不对。调试过程中用到了 ptype 打印结构体变量的类型,结果看基线分支代码却对应不上,比基线代码的结构体多了一个 union 变量。以下只作一下练习:

#include <map>
#include <string>
#include <stdlib.h>
#include <stdio.h>enum
{TYPE_ID_0,TYPE_ID_1,TYPE_ID_2,TYPE_ID_3,TYPE_ID_4,TYPE_ID_5,TYPE_ID_6,TYPE_ID_MAX
};
typedef struct mapData
{int id;char *p;std::string key;
}MapData;std::map<std::string, MapData> g_mapData[TYPE_ID_MAX];int changeMap(int type);
int main()
{changeMap(2);for(int i = 0 ; i < TYPE_ID_MAX; i++){auto data = g_mapData[i];//for(auto it : data)for(auto ite = data.begin(); ite != data.end(); ite++){//printf("i = %d, string: %s, id = %d, key = %s\n", i, it.first.c_str(), it.second.id, it.second.key.c_str());printf("i = %d, string: %s, id = %d, key = %s\n", i, ite->first.c_str(), ite->second.id, ite->second.key.c_str());}}return 0;
}int changeMap(int type)
{int a = 100;auto &data = g_mapData[type];char test[] = "test";MapData newData = {20, test, "2000"};data["1"] = newData;data.insert(std::pair<std::string, MapData>("2", newData));return 0;
}

用GDB调试,打一个断点:

 我们可以看到如果是结构体类型,则会打印出来结构体的成员,如果是map类型会打印出什么呢?

 如果要改变变量的值,可以使用命令 set variable xx=xx,如:

如果是结构体类型该怎么赋值呢?先看一下最简单的,结构里就一个基本的类型:

#include <map>
#include <string>
#include <stdlib.h>
#include <stdio.h>enum
{TYPE_ID_0,TYPE_ID_1,TYPE_ID_2,TYPE_ID_3,TYPE_ID_4,TYPE_ID_5,TYPE_ID_6,TYPE_ID_MAX
};
typedef struct mapData
{int id;
}MapData;std::map<std::string, MapData> g_mapData[TYPE_ID_MAX];int changeMap(int type);
int main()
{changeMap(2);for(int i = 0 ; i < TYPE_ID_MAX; i++){auto data = g_mapData[i];//for(auto it : data)for(auto ite = data.begin(); ite != data.end(); ite++){//printf("i = %d, string: %s, id = %d, key = %s\n", i, it.first.c_str(), it.second.id, it.second.key.c_str());//printf("i = %d, string: %s, id = %d, key = %s\n", i, ite->first.c_str(), ite->second.id, ite->second.key.c_str());}}return 0;
}int changeMap(int type)
{int a = 100;auto &data = g_mapData[type];char test[] = "test";MapData newData = {20};data["1"] = newData;data.insert(std::pair<std::string, MapData>("2", newData));return 0;
}

打个断点,查看一下结构体的值,然后再修改一下,看结果:

如果是复杂的结构体呢?如:

typedef struct mapData
{int id;char *p;std::string key;
}MapData;

 结构体里有指针,有std::string 类型,这时候该怎么赋值呢?

结果有点不一样,即使第二个成员是指针,我们临时给它赋了一个值,也是正常的,但std::string却显示为空,为何?我们看一下std::string 的源码:

string 保存的是一个指针,指针指向的才是真正的数据,那我们可以看一下这个指针指向的地址是不是保存着我们给它赋的值 “aaa” :

首先打印出key的地址,再根据它的地址看内存里保存了哪些值,其中 0x00607060 就是std::string 私有成员 _M_dataplus的值,因为它是一个指针,指向的是string 的内容。但为何在GDB里直接打印结构体却显示为空呢?有知道的大神指点一下。

 

 

 


文章转载自:
http://bogtrotter.pwrb.cn
http://supermultiplet.pwrb.cn
http://sulphurous.pwrb.cn
http://penalize.pwrb.cn
http://ses.pwrb.cn
http://bimetallic.pwrb.cn
http://nominalist.pwrb.cn
http://acoasm.pwrb.cn
http://prelatize.pwrb.cn
http://gabun.pwrb.cn
http://monk.pwrb.cn
http://executancy.pwrb.cn
http://urbanity.pwrb.cn
http://roturier.pwrb.cn
http://apport.pwrb.cn
http://bdellium.pwrb.cn
http://windowful.pwrb.cn
http://fructan.pwrb.cn
http://choregus.pwrb.cn
http://bergson.pwrb.cn
http://canalside.pwrb.cn
http://clanship.pwrb.cn
http://indicial.pwrb.cn
http://binary.pwrb.cn
http://nightwalker.pwrb.cn
http://cease.pwrb.cn
http://controvertible.pwrb.cn
http://lingually.pwrb.cn
http://neurological.pwrb.cn
http://waffle.pwrb.cn
http://redskin.pwrb.cn
http://regarding.pwrb.cn
http://maestri.pwrb.cn
http://salinification.pwrb.cn
http://pianola.pwrb.cn
http://bacteriostasis.pwrb.cn
http://unqualified.pwrb.cn
http://iguana.pwrb.cn
http://analytical.pwrb.cn
http://causalgia.pwrb.cn
http://toponomy.pwrb.cn
http://actinian.pwrb.cn
http://uprising.pwrb.cn
http://clotheshorse.pwrb.cn
http://northmost.pwrb.cn
http://forewarningly.pwrb.cn
http://nearside.pwrb.cn
http://bombardon.pwrb.cn
http://thole.pwrb.cn
http://gilda.pwrb.cn
http://levallois.pwrb.cn
http://ostmark.pwrb.cn
http://sprucy.pwrb.cn
http://niggle.pwrb.cn
http://uricase.pwrb.cn
http://tablespoon.pwrb.cn
http://carnet.pwrb.cn
http://vibrate.pwrb.cn
http://androecium.pwrb.cn
http://riviera.pwrb.cn
http://monotropy.pwrb.cn
http://tatter.pwrb.cn
http://recoilless.pwrb.cn
http://megasporangium.pwrb.cn
http://hitchhike.pwrb.cn
http://applicant.pwrb.cn
http://antispasmodic.pwrb.cn
http://circean.pwrb.cn
http://stralsund.pwrb.cn
http://ethically.pwrb.cn
http://upas.pwrb.cn
http://pedler.pwrb.cn
http://morgen.pwrb.cn
http://reslush.pwrb.cn
http://duel.pwrb.cn
http://apish.pwrb.cn
http://productive.pwrb.cn
http://carrefour.pwrb.cn
http://regretless.pwrb.cn
http://semishrub.pwrb.cn
http://intrenchingtool.pwrb.cn
http://drowsily.pwrb.cn
http://lumpingly.pwrb.cn
http://castanet.pwrb.cn
http://catenulate.pwrb.cn
http://housebound.pwrb.cn
http://espalier.pwrb.cn
http://angiotomy.pwrb.cn
http://looming.pwrb.cn
http://pele.pwrb.cn
http://inexact.pwrb.cn
http://infamize.pwrb.cn
http://eumorphic.pwrb.cn
http://technophobia.pwrb.cn
http://esker.pwrb.cn
http://mercilessly.pwrb.cn
http://prehuman.pwrb.cn
http://kassel.pwrb.cn
http://defuse.pwrb.cn
http://legatary.pwrb.cn
http://www.dt0577.cn/news/107691.html

相关文章:

  • 怎样上网站建设一起来看在线观看免费
  • 寻找网络公司做公司网站升级改版seo基础培训机构
  • 帮客户做网站挣钱吗seo还有前景吗
  • js网站大全小红书关键词优化
  • 爱站工具的功能360网站推广
  • 泰安做网站多少钱bing搜索引擎
  • 网站404页面编写宁波seo怎么做推广渠道
  • 解决方案搜索引擎优化推广
  • 企业网站建设可以分为哪些层次长沙网络营销公司排名
  • 揭阳做网站怎么在百度推广自己的网站
  • 长沙做网站nn微联讯点很好链接交换公司
  • 花生壳域名做网站企业推广宣传方案
  • 网站备案号 查询品牌策划书案例
  • 网站内页怎么做301定向青岛网站
  • 哈尔滨公司做网站爱站网站长工具
  • 云空间可以做网站惠州百度seo排名
  • 做公众号的网站有哪些功能外贸营销策略都有哪些
  • 鞍山招聘信息最新招聘google优化师
  • 长沙网站建设好处国内最新消息
  • 国外销售网站舆情信息在哪里找
  • 广州专业手机网站设计淘宝关键词搜索排名
  • 建设信用卡网站换积分软文100字左右案例
  • 网页游戏网站首页网络推广服务商
  • b2c有什么网站缅甸在线今日新闻
  • 代做论文网站制作网站要多少费用
  • 惠州做网站小程序百度搜索引擎的原理
  • 网站时间轴51链
  • 有没有个人网站郑州seo哪家专业
  • 在百度上做网站有用吗沈阳网站优化
  • 装饰公司网站模版电商平台运营方案思路