Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

compiler construction - Maximum Method Name Length

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.

What are the factors involved as well:

  • Does the language specification limit this?
  • What does the compiler limit it to?
    • Is it different on 32bit vs 64bit machines?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For C# I don't believe there's a specified hard limit. (Section 2.4.2 of the C# 5 spec doesn't give a limit, for example.) Roslyn v2.2.0.61624 seems to have a limit of 1024 characters; this is way beyond the bounds of readability and even a sensible machine-generated name.

For Java, section 3.8 of the spec states:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...