最大方法名称长度 [英] Maximum Method Name Length

查看:141
本文介绍了最大方法名称长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人碰巧知道一个方法名称的最大长度是在你的编程语言的选择?

Does anyone happen to know what the maximum length of a method name is in your programming language of choice? I was going to make this a C# specific question, but I think it would be nice to know across the spectrum.

这些因素也包括在内:


  • 语言规范是否对此有限制?

  • 编译器限制了什么?


    • 在32位和64位机器上不同吗?

    推荐答案

    对于C#我不相信有一个严格的限制 - 我想我以前研究过,得出结论,时间达到极限,你将超越可读性的范围,甚至一个明智的机器生成的名称。

    For C# I don't believe there's a hard limit - I think I looked into this before, and came to the conclusion that by the time you reached the limit you'd be way beyond the bounds of readability and even a sensible machine-generated name. Section 2.4.2 of the spec which describes identifiers doesn't give any limit.

    对于Java,规范的第3.8条规定:

    For Java, section 3.8 of the spec states:


    标识符是一个无限长的
    Java字母和Java
    数字序列,其中第一个必须是
    Java字母。

    An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.

    这篇关于最大方法名称长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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