Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ va_end(args)是否导致崩溃?_C++_Variadic Functions - Fatal编程技术网

C++ va_end(args)是否导致崩溃?

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

从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 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);