C ++中的静态全局标识符和非静态全局标识符有什么区别? [英] What is the difference between static global and non-static global identifier in C++?

查看:142
本文介绍了C ++中的静态全局标识符和非静态全局标识符有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++中的 static 全局和非 - 全局标识符之间的区别是什么?

What is the difference between static global and non-static global identifier in C++?

推荐答案

静态将变量的范围限制为相同 变量具有内部链接静态全局变量

非静态全局变量具有外部链接

Static limits the scope of the variable to the same translation unit.
A static global variable has internal linkage.
A non-static global variable has external linkage.

良好阅读:

C ++中的外部链接和内部链接

这篇关于C ++中的静态全局标识符和非静态全局标识符有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆