C++ va_end(args)是否导致崩溃?
从32位迁移到64位后,我们的服务器进程不断崩溃。coredump总是在调用va_end(args)后指向带有“}”的行 但由于我们使用了较新的gcc,因此存在编译错误:C++ va_end(args)是否导致崩溃?,c++,variadic-functions,C++,Variadic Functions,从32位迁移到64位后,我们的服务器进程不断崩溃。coredump总是在调用va_end(args)后指向带有“}”的行 但由于我们使用了较新的gcc,因此存在编译错误: src/DebugUtil.cpp:995: error: cannot allocate an object of abstract type 'GenericLogType' src/GenericLogType.h:45: note: because the following virtual functions
src/DebugUtil.cpp:995: error: cannot allocate an object of abstract type 'GenericLogType'
src/GenericLogType.h:45: note: because the following virtual functions are pure within 'GenericLogType':
src/ILogType.h:117: note: virtual std::string ILogType::getCompleteLogMessage(const std::string&, int, __
va_list_tag*)
为了解决编译错误,我将函数更改为:
void completeMessage (string& file, int line, va_list args);
args参数的传递会导致崩溃吗?或者核心文件可能完全关闭,因为它处于发布模式
我的gcc版本=4.4.7
CENTOS 6.4 Linux 2.6.32-358.el6.x86_64箭头上方的行不应编译
std::va_list
不应按值传递,因为它可以是数组类型。很可能您在其他地方遇到问题。您是否尝试过valgrind
ing它?如果您能提供一个完整的小示例来演示此行为,并将其发布到此处,以便我们可以尝试并调试它,这也会很有帮助。既然args
超出范围,那么不应该编译它吗?
void completeMessage (string& file, int line, va_list& args);
src/DebugUtil.cpp:995: error: cannot allocate an object of abstract type 'GenericLogType'
src/GenericLogType.h:45: note: because the following virtual functions are pure within 'GenericLogType':
src/ILogType.h:117: note: virtual std::string ILogType::getCompleteLogMessage(const std::string&, int, __
va_list_tag*)
void completeMessage (string& file, int line, va_list args);