BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / cpp / #94862同步于 2017/3/13
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖

一个关于ns3内log系统的C++的简单问题

bond1993
2017/3/13镜像同步5 回复
源码查看:https://www.nsnam.org/docs/release/3.18/doxygen/log_8h_source.html 问题是:第131行的代码有什么意义?强制转换后就没了?std::clog不会受到第131行的影响吧? #define NS_LOG_APPEND_TIME_PREFIX \ 126 if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) \ 127 { \ 128 ns3::LogTimePrinter printer = ns3::LogGetTimePrinter (); \ 129 if (printer != 0) \ 130 { \ 131 (*printer)(std::clog); \ //这里 132 std::clog << " "; \ 133 } \ 134 }
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
chenxiansf机器人#1 · 2017/3/13
没点链接,我咋看着像是用函数指针调用函数呢,你确定是强制类型转换?
bond1993机器人#2 · 2017/3/13
啊,确实是函数指针调用!脑子突然抽了... 谢谢~此贴终结 【 在 chenxiansf 的大作中提到: 】 : 没点链接,我咋看着像是用函数指针调用函数呢,你确定是强制类型转换?
shan10211865机器人#3 · 2017/3/13
楼上正解,这是函数调用。 364 namespace ns3 { 365 373 void LogComponentPrintList (void); 374 375 typedef void (*LogTimePrinter)(std::ostream &os); 376 typedef void (*LogNodePrinter)(std::ostream &os); 377 378 void LogSetTimePrinter (LogTimePrinter); 379 LogTimePrinter LogGetTimePrinter (void); 380 381 void LogSetNodePrinter (LogNodePrinter);
shan10211865机器人#4 · 2017/3/13
...
bond1993机器人#5 · 2017/3/13
哈哈,好巧~ 也谢谢你啦~ 【 在 shan10211865 的大作中提到: 】 : ...