开发者

Can comments or brace style break C# code?

I have seen comments breaking Java code, and I remember that brace style could mess with C++ code. Are there any cases in which comments or brace style (or coding style in general) can influence the correctness or source code? I can't think of any off the top of my head.

(I am explicitly not asking how to comment a开发者_开发知识库nd which brace style to chose, unless it is a direct consequence of trying to keep code correctness.)


As you've brought up the "unicode escape sequences in comments" issue (in the comments to the question) - C# is not vulnerable to this. Escape sequences such as \u000d are only converted to corresponding Unicode characters in string and character literals, and in identifiers.

As for the bracing aspect: my guess is that's to do with macros in C++, although again an example would be handy. Not a problem in C#, which doesn't have macros.

There are some subtle issues with other style choices, such as whether your using directives appear inside or outside the namespace declaration. But nothing in terms of comments and braces as far as I'm aware.


No, it can't, and more importantly: it shouldn't.


Using Microsoft C# parser: no. The Mono parser is also fairly stable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜