这是函数声明吗?
is this a function declaration?
当我从 OpenCV 或 OpenCascade 读取一些代码时,我经常在 C++ 中看到这种类型的声明+实现
TEST(Shape_SCD, regression)
{
const int NSN_val=5;//10;//20; //number of shapes per class
const int NP_val=120; //number of points simplifying the contour
const float CURRENT_MAX_ACCUR_val=95; //99% and 100% reached in several tests, 95 is fixed as minimum boundary
ShapeBaseTest<float, computeShapeDistance_Chi> test(NSN_val, NP_val, CURRENT_MAX_ACCUR_val);
test.safe_run();
}
这可能是个愚蠢的问题,不是吗?因为我不知道这是什么类型的声明。它看起来确实像一个函数,但没有 return 类型。如果它是构造函数,为什么参数列表中没有任何类型的变量?
谢谢
TEST
是一个宏。宏展开后,这将是一个普通的函数定义(具有 return 类型)。你查一下宏的定义应该就能看出来了。
当我从 OpenCV 或 OpenCascade 读取一些代码时,我经常在 C++ 中看到这种类型的声明+实现
TEST(Shape_SCD, regression)
{
const int NSN_val=5;//10;//20; //number of shapes per class
const int NP_val=120; //number of points simplifying the contour
const float CURRENT_MAX_ACCUR_val=95; //99% and 100% reached in several tests, 95 is fixed as minimum boundary
ShapeBaseTest<float, computeShapeDistance_Chi> test(NSN_val, NP_val, CURRENT_MAX_ACCUR_val);
test.safe_run();
}
这可能是个愚蠢的问题,不是吗?因为我不知道这是什么类型的声明。它看起来确实像一个函数,但没有 return 类型。如果它是构造函数,为什么参数列表中没有任何类型的变量?
谢谢
TEST
是一个宏。宏展开后,这将是一个普通的函数定义(具有 return 类型)。你查一下宏的定义应该就能看出来了。