Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Maximum length of Static name?

Reply
Thread Tools

Maximum length of Static name?

 
 
harry
Guest
Posts: n/a
 
      02-01-2006
This is probably a silly question but is there a maximum number of
characters for a static name?

i.e

public static final int ABCDEFGHIJKLMOPQRSTUVWXYZ........... = 1;


 
Reply With Quote
 
 
 
 
Arnaud B.
Guest
Posts: n/a
 
      02-01-2006
Hi,

I think there is no limit if it is alaways represented as a String object
like in

: getField(String name) from class java.lang.Class .

But, why would you care?

Arnaud


"harry" <(E-Mail Removed)> a écrit dans le message de
news:Qg4Ef.13247$(E-Mail Removed) k...
> This is probably a silly question but is there a maximum number of
> characters for a static name?
>
> i.e
>
> public static final int ABCDEFGHIJKLMOPQRSTUVWXYZ........... = 1;
>
>



 
Reply With Quote
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      02-01-2006
"harry" <(E-Mail Removed)> writes:
>This is probably a silly question but is there a maximum number of
>characters for a static name?


There are no "static names" in Java.

I assume, you meant "for an identifier".

The answer is given by the Java Language Specification, Third
Edition in Section 3.8:

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

 
Reply With Quote
 
opalpa@gmail.com opalinski from opalpaweb
Guest
Posts: n/a
 
      02-01-2006
There is a limit in implementaitons I've used. Error message is like:

UTF8 representation for string "ABCDEFGHIJKLMOPQRSTUVWXYZ..." is too
long for the constant pool.

Also there used to be, haven't run into it for while, probably still
there, a limit on class size. Used to be 640000 bytes.

Opalinski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.geocities.com/opalpaweb/

 
Reply With Quote
 
opalpa@gmail.com opalinski from opalpaweb
Guest
Posts: n/a
 
      02-01-2006
The limit is pretty big for String names for practical purposes btw,
you can make it thousands of characters long.

> Also there used to be, haven't run into it for while, probably still
> there, a limit on class size. Used to be 640000 bytes.


This might have been a source size limit. I don't remember.

Opalinski
(E-Mail Removed)
http://www.geocities.com/opalpaweb/

 
Reply With Quote
 
harry
Guest
Posts: n/a
 
      02-01-2006
I have some statics that need to be 30'ish chars long to make them
understandable, seem to remember something somewhere ignoring chars after
32 - really can't remember where, may have even been Cobol many years ago!

Many thanks for all replies!



"Arnaud B." <(E-Mail Removed)> wrote in message
news:drqk1k$jvg$(E-Mail Removed)...
> Hi,
>
> I think there is no limit if it is alaways represented as a String object
> like in
>
> : getField(String name) from class java.lang.Class .
>
> But, why would you care?
>
> Arnaud
>
>
> "harry" <(E-Mail Removed)> a écrit dans le message de
> news:Qg4Ef.13247$(E-Mail Removed) k...
> > This is probably a silly question but is there a maximum number of
> > characters for a static name?
> >
> > i.e
> >
> > public static final int ABCDEFGHIJKLMOPQRSTUVWXYZ........... = 1;
> >
> >

>
>



 
Reply With Quote
 
opalpa@gmail.com opalinski from opalpaweb
Guest
Posts: n/a
 
      02-01-2006
Don't know about Cobol, but earlier versions of Fortran had very small
limits. I was maintaining some Fortran about a year ago and asked why
a currency conversion rate was something like fxq2ctq and was informed
that Fortan's original limitations were 7 characters for uniquness and
that alot of them got used up.

This is not a problem for Java. Java does not truncate identifiers.


Opalinski
(E-Mail Removed)
http://www.geocities.com/opalpaweb/

 
Reply With Quote
 
bugbear
Guest
Posts: n/a
 
      02-01-2006
(E-Mail Removed) opalinski from opalpaweb wrote:
> Don't know about Cobol, but earlier versions of Fortran had very small
> limits. I was maintaining some Fortran about a year ago and asked why
> a currency conversion rate was something like fxq2ctq and was informed
> that Fortan's original limitations were 7 characters for uniquness and
> that alot of them got used up.


IIRC Whitesmith's 'C' silently ignored anything
after 6 chars. We tended to use longer indentifiers
for readability.

This led to an EVIL bug when we upgraded
the compiler; we some variable that differed (due a typo)
in char 7 (or 8 or something).

Code ran under Whitesmiths, but not under the new comp.

BugBear
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-01-2006
On Wed, 01 Feb 2006 15:16:00 GMT, "harry" <(E-Mail Removed)> wrote, quoted or
indirectly quoted someone who said :

>This is probably a silly question but is there a maximum number of
>characters for a static name?


see http://mindprod.com/jgloss/naming.html#TECHNICAL
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-01-2006
On Wed, 01 Feb 2006 15:56:28 GMT, "harry" <(E-Mail Removed)> wrote, quoted or
indirectly quoted someone who said :

>I have some statics that need to be 30'ish chars long to make them
>understandable, seem to remember something somewhere ignoring chars after
>32 - really can't remember where, may have even been Cobol many years ago!


might have been IBM PL/If or Univac 90/30 COBOL. One of them just
quietly ignored the tail ends of your identifiers leading to some very
peculiar bugs.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to handle "Maximum request length exceeded" exception =?Utf-8?B?Y21heQ==?= ASP .Net 8 04-02-2012 04:20 PM
Creating the maximum number of menus and maximum number of stills rossco DVD Video 2 11-24-2005 09:33 PM
Application_Error and Maximum request length exceeded Jacky Kwok ASP .Net 2 06-24-2005 08:24 AM
The number name 'System.Web.UI.WebControls' contains more than the maximum number of prefixes. The maximum is 3. mayur ASP .Net Web Controls 2 07-16-2004 05:14 PM
The number name 'System.Web.UI.WebControls' contains more than the maximum number of prefixes. The maximum is 3. mayur ASP .Net 2 07-02-2004 10:35 AM



Advertisments