函数后的分号 [英] Semicolon after Function

查看:23
本文介绍了函数后的分号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人把分号放在大括号结束函数后面有什么具体原因吗?

Is there a specific reason why some people put a semicolon after the curly closing function bracket?

void foo() {

};

推荐答案

不是真的,分号没有区别.可能是习惯问题.

Not really, the semicolon there makes no difference. It's probably a matter of habit.

如果需要,您可以在 C++11 中放置尽可能多的分号:

You can put as many semicolons if you want though in C++11:

void foo() {

};;;;;;;;

这篇关于函数后的分号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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