为什么没有;;导致 VS 中的构建错误? [英] Why doesn't ; ; result in a build error in VS?

查看:17
本文介绍了为什么没有;;导致 VS 中的构建错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不管多少;您放置在 C# 代码行的末尾,编译器不会显示错误并且构建成功.

No matter how much ; you placed at the end of a C# code line, the compiler will not show an error and the build is successful.

几乎所有其他语言,如 C、C++ 和 Java.这是不允许的.

In almost all other languages like C, C++ and Java. This is not allowed.

推荐答案

有趣的是与 Eric 的博客有关,为什么这不是警告.

Interestingly related to Eric's blog on why is this not a warning.

来自 Eric Lippert 的博客我经常被问到为什么一大堆难闻的代码不会产生编译器警告."

From Eric Lippert's blog " I am often asked why a particular hunk of bad-smelling code does not produce a compiler warning."

http://blogs.msdn.com/b/ericlippert/archive/2011/03/03/danger-will-robinson.aspx

关键是,是否可以很好地利用编译器团队的宝贵时间来引入这样的警告?

The point being, would it be good use of the compiler teams valuable time to introduce such a warning?

这篇关于为什么没有;;导致 VS 中的构建错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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