news 2026/2/10 7:20:38

C++ 程序中变量/函数的范围(可见性)和生命周期

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
C++ 程序中变量/函数的范围(可见性)和生命周期

存储类定义 C++ 程序中变量/函数的范围(可见性)和生命周期。这些说明符放置在它们所修饰的类型之前。下面列出 C++ 程序中可用的存储类:

  • auto:这是默认的存储类说明符,通常可以省略不写。auto 指定的变量具有自动存储期,即它们的生命周期仅限于定义它们的块(block)。auto 变量通常在栈上分配。

  • register:用于建议编译器将变量存储在CPU寄存器中以提高访问速度。在 C++11 及以后的版本中,register 已经是一个废弃的特性,不再具有实际作用。

  • static:用于定义具有静态存储期的变量或函数,它们的生命周期贯穿整个程序的运行期。在函数内部,static变量的值在函数调用之间保持不变。在文件内部或全局作用域,static变量具有内部链接,只能在定义它们的文件中访问。

  • extern:用于声明具有外部链接的变量或函数,它们可以在多个文件之间共享。默认情况下,全局变量和函数具有 extern 存储类。在一个文件中使用extern声明另一个文件中定义的全局变量或函数,可以实现跨文件共享。

  • mutable (C++11):用于修饰类中的成员变量,允许在const成员函数中修改这些变量的值。通常用于缓存或计数器等需要在const上下文中修改的数据。

  • thread_local (C++11):用于定义具有线程局部存储期的变量,每个线程都有自己的独立副本。线程局部变量的生命周期与线程的生命周期相同。

从 C++ 17 开始,auto 关键字不再是 C++ 存储类说明符,且 register 关键字被弃用。

中的存储类说明符为程序员提供了控制变量和函数生命周期及可见性的手段。

合理使用存储类说明符可以提高程序的可维护性和性能。

从 C++11 开始,register 已经失去了原有的作用,而 mutable 和 thread_local 则是新引入的特性,用于解决特定的编程问题。

下面是一个展示不同存储类说明符的实例:

实例

#include <iostream>

// 全局变量,具有外部链接,默认存储类为extern
int globalVar;

void function() {
// 局部变量,具有自动存储期,默认存储类为auto
auto int localVar = 10;

// 静态变量,具有静态存储期,生命周期贯穿整个程序
static int staticVar = 20;

const int constVar = 30; // const变量默认具有static存储期

// 尝试修改const变量,编译错误
// constVar = 40;

// mutable成员变量,可以在const成员函数中修改
class MyClass {
public:
mutable int mutableVar;

void constMemberFunc() const {
mutableVar = 50; // 允许修改mutable成员变量
}
};

// 线程局部变量,每个线程有自己的独立副本
thread_local int threadVar = 60;
}

int main() {
extern int externalVar; // 声明具有外部链接的变量

function();

return 0;
}

auto 存储类

自 C++ 11 以来,auto关键字用于两种情况:声明变量时根据初始化表达式自动推断该变量的类型、声明函数时函数返回值的占位符。

C++98 标准中 auto 关键字用于自动变量的声明,但由于使用极少且多余,在 C++17 中已删除这一用法。

根据初始化表达式自动推断被声明的变量的类型,如:

auto f=3.14; //double auto s("hello"); //const char* auto z = new auto(9); // int* auto x1 = 5, x2 = 5.0, x3='r';//错误,必须是初始化为同一类型

register 存储类

register 是一种存储类(storage class),用于声明变量,并提示编译器将这些变量存储在寄存器中,以便快速访问。

使用 register 关键字可以提高程序的执行速度,因为它减少了对内存的访问次数。

然而,需要注意的是,register 存储类只是一种提示,编译器可以忽略它,因为现代的编译器通常会自动优化代码,选择合适的存储位置。

语法格式:

register data_type variable_name;
  • register是存储类的关键字,用于提示编译器将变量存储在寄存器中。
  • data_type是变量的数据类型,可以是任何合法的 C++ 数据类型。
  • variable_name是变量的名称。

void loop() { register int i; for (i = 0; i < 1000; ++i) { // 循环体 } }

register 存储类用于提示编译器将变量存储在寄存器中,以便提高访问速度。然而,由于现代编译器的自动优化能力,使用 register 关键字并不是必需的,而且在实践中很少使用。

在 C++11 标准中,register 关键字不再是一个存储类说明符,而是一个废弃的特性。这意味着在 C++11 及以后的版本中,使用 register 关键字将不会对程序产生任何影响。

在 C++ 中,可以使用引用或指针来提高访问速度,尤其是在处理大型数据结构时。

static 存储类

static存储类指示编译器在程序的生命周期内保持局部变量的存在,而不需要在每次它进入和离开作用域时进行创建和销毁。因此,使用 static 修饰局部变量可以在函数调用之间保持局部变量的值。

static 修饰符也可以应用于全局变量。当 static 修饰全局变量时,会使变量的作用域限制在声明它的文件内。

在 C++ 中,当 static 用在类数据成员上时,会导致仅有一个该成员的副本被类的所有对象共享。

实例

#include <iostream> // 函数声明 void func(void); static int count = 10; /* 全局变量 */ int main() { while(count--) { func(); } return 0; } // 函数定义 void func( void ) { static int i = 5; // 局部静态变量 i++; std::cout << "变量 i 为 " << i ; std::cout << " , 变量 count 为 " << count << std::endl; }

当上面的代码被编译和执行时,它会产生下列结果:

变量 i 为 6 , 变量 count 为 9 变量 i 为 7 , 变量 count 为 8 变量 i 为 8 , 变量 count 为 7 变量 i 为 9 , 变量 count 为 6 变量 i 为 10 , 变量 count 为 5 变量 i 为 11 , 变量 count 为 4 变量 i 为 12 , 变量 count 为 3 变量 i 为 13 , 变量 count 为 2 变量 i 为 14 , 变量 count 为 1 变量 i 为 15 , 变量 count 为 0

extern 存储类

extern存储类用于提供一个全局变量的引用,全局变量对所有的程序文件都是可见的。当您使用 'extern' 时,对于无法初始化的变量,会把变量名指向一个之前定义过的存储位置。

当您有多个文件且定义了一个可以在其他文件中使用的全局变量或函数时,可以在其他文件中使用extern来得到已定义的变量或函数的引用。可以这么理解,extern是用来在另一个文件中声明一个全局变量或函数。

extern 修饰符通常用于当有两个或多个文件共享相同的全局变量或函数的时候,如下所示:

第一个文件:main.cpp

实例

#include <iostream> int count ; extern void write_extern(); int main() { count = 5; write_extern(); }

第二个文件:support.cpp

实例

#include <iostream> extern int count; void write_extern(void) { std::cout << "Count is " << count << std::endl; }

在这里,第二个文件中的extern关键字用于声明已经在第一个文件 main.cpp 中定义的 count。现在 ,编译这两个文件,如下所示:

$ g++ main.cpp support.cpp -o write

这会产生write可执行程序,尝试执行write,它会产生下列结果:

$ ./write Count is 5

mutable 存储类

mutable 是一个关键字,用于修饰类的成员变量,使其能够在 const 成员函数中被修改。通常情况下,const 成员函数不能修改对象的状态,但如果某个成员变量被声明为 mutable,则可以在 const 函数中对其进行修改。

特点:

  • 允许修改mutable成员变量可以在const成员函数内被改变。
  • 设计目的:通常用于需要在不改变对象外部状态的情况下进行状态管理的场景,比如缓存、延迟计算等。

实例

#include <iostream>

class Example {
public:
Example() : value(0), cachedValue(0) {}

// 常量成员函数
int getValue() const {
return value; // 读取常量成员
}

// 修改 mutable 成员
void increment() {
++value;
cachedValue = value * 2; // 修改 mutable 成员
}

int getCachedValue() const {
return cachedValue; // 读取 mutable 成员
}

https://avg.163.com/topic/detail/8121231
https://avg.163.com/topic/detail/8121250
https://avg.163.com/topic/detail/8103525
https://avg.163.com/topic/detail/8121276
https://avg.163.com/topic/detail/8104256
https://avg.163.com/topic/detail/8121300
https://avg.163.com/topic/detail/8104887
https://avg.163.com/topic/detail/8103532
https://avg.163.com/topic/detail/8105566
https://avg.163.com/topic/detail/8104264
https://avg.163.com/topic/detail/8106223
https://avg.163.com/topic/detail/8121212
https://avg.163.com/topic/detail/8121220
https://avg.163.com/topic/detail/8121235
https://avg.163.com/topic/detail/8103530
https://avg.163.com/topic/detail/8121260
https://avg.163.com/topic/detail/8104258
https://avg.163.com/topic/detail/8121280
https://avg.163.com/topic/detail/8104901
https://avg.163.com/topic/detail/8121239
https://avg.163.com/topic/detail/8105575
https://avg.163.com/topic/detail/8121254
https://avg.163.com/topic/detail/8121210
https://avg.163.com/topic/detail/8121278
https://avg.163.com/topic/detail/8121233
https://avg.163.com/topic/detail/8121301
https://avg.163.com/topic/detail/8121257
https://avg.163.com/topic/detail/8121282
https://avg.163.com/topic/detail/8121294
https://avg.163.com/topic/detail/8103521
https://avg.163.com/topic/detail/8104252
https://avg.163.com/topic/detail/8104897
https://avg.163.com/topic/detail/8105571
https://avg.163.com/topic/detail/8106235
https://avg.163.com/topic/detail/8121219
https://avg.163.com/topic/detail/8121229
https://avg.163.com/topic/detail/8121255
https://avg.163.com/topic/detail/8121277
https://avg.163.com/topic/detail/8121297
https://avg.163.com/topic/detail/8103519
https://avg.163.com/topic/detail/8103515
https://avg.163.com/topic/detail/8104263
https://avg.163.com/topic/detail/8103516
https://avg.163.com/topic/detail/8121230
https://avg.163.com/topic/detail/8104260
https://avg.163.com/topic/detail/8121249
https://avg.163.com/topic/detail/8104882
https://avg.163.com/topic/detail/8121273
https://avg.163.com/topic/detail/8105565
https://avg.163.com/topic/detail/8121291
https://avg.163.com/topic/detail/8106219
https://avg.163.com/topic/detail/8104265
https://avg.163.com/topic/detail/8121218
https://avg.163.com/topic/detail/8104885
https://avg.163.com/topic/detail/8121238
https://avg.163.com/topic/detail/8105564
https://avg.163.com/topic/detail/8121261
https://avg.163.com/topic/detail/8121217
https://avg.163.com/topic/detail/8121274
https://avg.163.com/topic/detail/8121236
https://avg.163.com/topic/detail/8121252
https://avg.163.com/topic/detail/8121281
https://avg.163.com/topic/detail/8121302
https://avg.163.com/topic/detail/8103527
https://avg.163.com/topic/detail/8104249
https://avg.163.com/topic/detail/8121216
https://avg.163.com/topic/detail/8121228
https://avg.163.com/topic/detail/8103523
https://avg.163.com/topic/detail/8121248
https://avg.163.com/topic/detail/8104246
https://avg.163.com/topic/detail/8121271
https://avg.163.com/topic/detail/8104878
https://avg.163.com/topic/detail/8121289
https://avg.163.com/topic/detail/8105570
https://avg.163.com/topic/detail/8103513
https://avg.163.com/topic/detail/8104259
https://avg.163.com/topic/detail/8104876
https://avg.163.com/topic/detail/8103520
https://avg.163.com/topic/detail/8104250
https://avg.163.com/topic/detail/8105561
https://avg.163.com/topic/detail/8106224
https://avg.163.com/topic/detail/8104889
https://avg.163.com/topic/detail/8105574
https://avg.163.com/topic/detail/8106245
https://avg.163.com/topic/detail/8121213
https://avg.163.com/topic/detail/8106227
https://avg.163.com/topic/detail/8121214
https://avg.163.com/topic/detail/8121234
https://avg.163.com/topic/detail/8121258
https://avg.163.com/topic/detail/8121279
https://avg.163.com/topic/detail/8121292
https://avg.163.com/topic/detail/8121232
https://avg.163.com/topic/detail/8121211
https://avg.163.com/topic/detail/8121259
https://avg.163.com/topic/detail/8121237
https://avg.163.com/topic/detail/8121272
https://avg.163.com/topic/detail/8121256
https://avg.163.com/topic/detail/8121299
https://avg.163.com/topic/detail/8121283
https://avg.163.com/topic/detail/8121298
https://avg.163.com/topic/detail/8103510
https://avg.163.com/topic/detail/8104253
https://avg.163.com/topic/detail/8104877
https://avg.163.com/topic/detail/8105562
https://avg.163.com/topic/detail/8106231
https://avg.163.com/topic/detail/8121227
https://avg.163.com/topic/detail/8121251
https://avg.163.com/topic/detail/8121275
https://avg.163.com/topic/detail/8103509
https://avg.163.com/topic/detail/8104251
https://avg.163.com/topic/detail/8104883
https://avg.163.com/topic/detail/8105569
https://avg.163.com/topic/detail/8106243
https://avg.163.com/topic/detail/8121209
https://avg.163.com/topic/detail/8121225
https://avg.163.com/topic/detail/8121247
https://avg.163.com/topic/detail/8121269
https://avg.163.com/topic/detail/8121296
https://avg.163.com/topic/detail/8103506
https://avg.163.com/topic/detail/8104255
https://avg.163.com/topic/detail/8104880
https://avg.163.com/topic/detail/8105559
https://avg.163.com/topic/detail/8106247
https://avg.163.com/topic/detail/8121208
https://avg.163.com/topic/detail/8121226
https://avg.163.com/topic/detail/8121253
https://avg.163.com/topic/detail/8121270
https://avg.163.com/topic/detail/8121290
https://avg.163.com/topic/detail/8121167
https://avg.163.com/topic/detail/8121170
https://avg.163.com/topic/detail/8121173
https://avg.163.com/topic/detail/8121180
https://avg.163.com/topic/detail/8121148
https://avg.163.com/topic/detail/8121153
https://avg.163.com/topic/detail/8121158
https://avg.163.com/topic/detail/8121162
https://avg.163.com/topic/detail/8121130
https://avg.163.com/topic/detail/8121133
https://avg.163.com/topic/detail/8121137
https://avg.163.com/topic/detail/8121139
https://avg.163.com/topic/detail/8121112
https://avg.163.com/topic/detail/8121116
https://avg.163.com/topic/detail/8121120
https://avg.163.com/topic/detail/8121124
https://avg.163.com/topic/detail/8117422
https://avg.163.com/topic/detail/8117429
https://avg.163.com/topic/detail/8117437
https://avg.163.com/topic/detail/8117874
https://avg.163.com/topic/detail/8116330
https://avg.163.com/topic/detail/8116332
https://avg.163.com/topic/detail/8116464
https://avg.163.com/topic/detail/8113729
https://avg.163.com/topic/detail/8113257
https://avg.163.com/topic/detail/8113303
https://avg.163.com/topic/detail/8113328
https://avg.163.com/topic/detail/8110423
https://avg.163.com/topic/detail/8110372
https://avg.163.com/topic/detail/8110385
https://avg.163.com/topic/detail/8110384
https://avg.163.com/topic/detail/8110378
https://avg.163.com/topic/detail/8110377
https://avg.163.com/topic/detail/8110371
https://avg.163.com/topic/detail/8110381
https://avg.163.com/topic/detail/8110367
https://avg.163.com/topic/detail/8110375
https://avg.163.com/topic/detail/8110382
https://avg.163.com/topic/detail/8110368
https://avg.163.com/topic/detail/8110376
https://avg.163.com/topic/detail/8110370
https://avg.163.com/topic/detail/8110380
https://avg.163.com/topic/detail/8110369
https://avg.163.com/topic/detail/8110374
https://avg.163.com/topic/detail/8110379
https://avg.163.com/topic/detail/8110366
https://avg.163.com/topic/detail/8110416
https://avg.163.com/topic/detail/8110385
https://avg.163.com/topic/detail/8110382
https://avg.163.com/topic/detail/8110384
https://avg.163.com/topic/detail/8110380
https://avg.163.com/topic/detail/8110379
https://avg.163.com/topic/detail/8110381
https://avg.163.com/topic/detail/8110378
https://avg.163.com/topic/detail/8110372
https://avg.163.com/topic/detail/8110377
https://avg.163.com/topic/detail/8110375
https://avg.163.com/topic/detail/8110371
https://avg.163.com/topic/detail/8110370
https://avg.163.com/topic/detail/8110368
https://avg.163.com/topic/detail/8110337
https://avg.163.com/topic/detail/8110343
https://avg.163.com/topic/detail/8110373
https://avg.163.com/topic/detail/8110369
https://avg.163.com/topic/detail/8110367
https://avg.163.com/topic/detail/8110366
https://avg.163.com/topic/detail/8110342
https://avg.163.com/topic/detail/8110347
https://avg.163.com/topic/detail/8110346
https://avg.163.com/topic/detail/8110345
https://avg.163.com/topic/detail/8110344
https://avg.163.com/topic/detail/8110343
https://avg.163.com/topic/detail/8110342
https://avg.163.com/topic/detail/8110341
https://avg.163.com/topic/detail/8110339
https://avg.163.com/topic/detail/8110340
https://avg.163.com/topic/detail/8110338
https://avg.163.com/topic/detail/8110337
https://avg.163.com/topic/detail/8110336
https://avg.163.com/topic/detail/8110335
https://avg.163.com/topic/detail/8110302
https://avg.163.com/topic/detail/8110301
https://avg.163.com/topic/detail/8110258
https://avg.163.com/topic/detail/8110257
https://avg.163.com/topic/detail/8110253
https://avg.163.com/topic/detail/8110296
https://avg.163.com/topic/detail/8110295
https://avg.163.com/topic/detail/8110258
https://avg.163.com/topic/detail/8110257
https://avg.163.com/topic/detail/8110256
https://avg.163.com/topic/detail/8110253
https://avg.163.com/topic/detail/8110252
https://avg.163.com/topic/detail/8098242
https://avg.163.com/topic/detail/8098270
https://avg.163.com/topic/detail/8098297
https://avg.163.com/topic/detail/8098355
https://avg.163.com/topic/detail/8098247
https://avg.163.com/topic/detail/8098238
https://avg.163.com/topic/detail/8098279
https://avg.163.com/topic/detail/8098232
https://avg.163.com/topic/detail/8098306
https://avg.163.com/topic/detail/8098301
https://avg.163.com/topic/detail/8098276
https://avg.163.com/topic/detail/8098228
https://avg.163.com/topic/detail/8098274
https://avg.163.com/topic/detail/8098237
https://avg.163.com/topic/detail/8098302
https://avg.163.com/topic/detail/8098261
https://avg.163.com/topic/detail/8098328
https://avg.163.com/topic/detail/8098235
https://avg.163.com/topic/detail/8098266
https://avg.163.com/topic/detail/8098246
https://avg.163.com/topic/detail/8098278
https://avg.163.com/topic/detail/8098244
https://avg.163.com/topic/detail/8098309
https://avg.163.com/topic/detail/8098226
https://avg.163.com/topic/detail/8098234
https://avg.163.com/topic/detail/8098280
https://avg.163.com/topic/detail/8098258
https://avg.163.com/topic/detail/8098287
https://avg.163.com/topic/detail/8098289
https://avg.163.com/topic/detail/8098190
https://avg.163.com/topic/detail/8098214
https://avg.163.com/topic/detail/8098248
https://avg.163.com/topic/detail/8098313
https://avg.163.com/topic/detail/8098141
https://avg.163.com/topic/detail/8097984
https://avg.163.com/topic/detail/8097994


private:
int value; // 常规成员,不能在 const 函数中修改
mutable int cachedValue; // 可修改成员,可以在 const 函数中修改
};

int main() {
const Example ex;
// ex.increment(); // 错误:无法在 const 对象上调用非 const 函数
// ex.value = 10; // 错误:无法修改 const 对象的成员

std::cout << "Value: " << ex.getValue() << std::endl;
std::cout << "Cached Value: " << ex.getCachedValue() << std::endl; // 输出为 0

return 0;
}

适用场景:

  • 缓存:在const函数中计算并缓存结果,而不影响对象的外部状态。
  • 状态跟踪:如日志计数器,跟踪调用次数等信息,避免对类的逻辑进行侵入式修改。

注意事项:

  • mutable变量的使用应谨慎,以免导致意外的状态变化,影响代码的可读性和可维护性。
  • mutable适用于需要在const环境中更改状态的特定情况,而不是普遍的设计模式。

thread_local 存储类

thread_local 是 C++11 引入的一种存储类,用于在多线程环境中管理线程特有的变量。

使用 thread_local 修饰的变量在每个线程中都有独立的实例,因此每个线程对该变量的操作不会影响其他线程。

  • 独立性:每个线程都有自己独立的变量副本,不同线程之间的读写操作互不干扰。
  • 生命周期thread_local变量在其线程结束时自动销毁。
  • 初始化thread_local变量可以进行静态初始化或动态初始化,支持在声明时初始化。

thread_local 适合用于需要存储线程状态、缓存或者避免数据竞争的场景,如线程池、请求上下文等。

以下演示了可以被声明为 thread_local 的变量:

#include <iostream> #include <thread> thread_local int threadSpecificVar = 0; // 每个线程都有自己的 threadSpecificVar void threadFunction(int id) { threadSpecificVar = id; // 设置线程特有的变量 std::cout << "Thread " << id << ": threadSpecificVar = " << threadSpecificVar << std::endl; } int main() { std::thread t1(threadFunction, 1); std::thread t2(threadFunction, 2); t1.join(); t2.join(); return 0; }

注意事项:

  • 性能:由于每个线程都有独立的副本,thread_local变量的访问速度可能比全局或静态变量稍慢。
  • 静态存储thread_local变量的存储类型为静态存储持续时间,因此在程序整个运行期间会一直存在。
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/2/9 4:40:14

Rust Web开发终极指南:Cot框架快速入门教程

Rust Web开发终极指南&#xff1a;Cot框架快速入门教程 【免费下载链接】cot The Rust web framework for lazy developers. 项目地址: https://gitcode.com/gh_mirrors/cot3/cot 想要快速构建Rust Web应用却不知从何开始&#xff1f;Cot框架正是为你量身定制的解决方案…

作者头像 李华
网站建设 2026/2/4 12:41:07

5大核心功能使YashanDB数据库适应多种场景

数据库系统在满足不同业务场景的需求时&#xff0c;通常面临性能瓶颈、数据一致性保障、可扩展性以及高可用性等挑战。随着海量数据处理和分布式计算的发展&#xff0c;数据库需要兼顾事务处理与分析能力&#xff0c;保证快速响应的同时确保数据的安全和完整。本文将详尽剖析Ya…

作者头像 李华
网站建设 2026/2/6 17:57:02

5个YashanDB的成功实施经验借鉴与分享

5个YashanDB的成功实施经验借鉴与分享在当今数据驱动的企业环境中&#xff0c;数据库技术的发展逐渐显现出其关键作用。然而&#xff0c;企业在实施数据库方案时常常面临一系列挑战&#xff0c;包括性能瓶颈、数据一致性问题及高可用性需求等。在这样的背景下&#xff0c;Yasha…

作者头像 李华
网站建设 2026/2/7 11:31:44

5个YashanDB的核心优势助力企业数据管理

在当今数据驱动的商业环境中&#xff0c;企业面临着多种数据管理挑战。这些挑战包括性能瓶颈、数据一致性问题、存储容量不足、扩展性不足等。这些挑战使企业需要一种高效且可伸缩的数据库解决方案&#xff0c;以支持其运营和增长。YashanDB作为一种新兴的数据库技术&#xff0…

作者头像 李华
网站建设 2026/2/7 2:54:16

别再盲目选型!Open-AutoGLM与MobiAgent准确率对比全解析

第一章&#xff1a;别再盲目选型&#xff01;Open-AutoGLM与MobiAgent准确率对比全解析 在边缘计算与轻量化AI模型快速发展的背景下&#xff0c;Open-AutoGLM与MobiAgent作为两款面向自动化推理任务的开源框架&#xff0c;受到了广泛关注。二者均宣称支持低延迟部署与高精度推理…

作者头像 李华
网站建设 2026/2/7 22:10:58

FaceFusion如何避免头发边缘锯齿?抗锯齿设置技巧

FaceFusion如何避免头发边缘锯齿&#xff1f;抗锯齿设置技巧 在AI换脸技术日益普及的今天&#xff0c;FaceFusion因其开源、模块化和高兼容性成为许多内容创作者的首选工具。但即便模型再先进&#xff0c;一个常见的视觉“破绽”始终困扰着用户&#xff1a; 换脸后人物的头发边…

作者头像 李华