☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

可变参数列表中省略号的前一个形式参数为引用、数组、函数,或具有与默认参数提升后不兼容的类型

C++-Undefined-Behavior-89
目录 › next › previous

示例:

void foo(int& n, ...);      // Undefined behavior
void foo(int f(), ...);     // Undefined behavior
void foo(int a[10], ...);   // Undefined behavior
void foo(char c, ...);      // Undefined behavior

例中参数 n、f、a 分别为引用、函数和数组,会导致未定义的行为,c 与默认参数提升后的类型不符,也会导致未定义的行为。

依据

ISO/IEC 14882:2003 18.7(3)-undefined ISO/IEC 14882:2011 18.10(3)-undefined

规则

ID_badParmN ID_forbidVariadicFunction
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.