Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Best way to control that compiler manage variable names longer then 8 signs.

Reply
Thread Tools

Best way to control that compiler manage variable names longer then 8 signs.

 
 
Carramba
Guest
Posts: n/a
 
      02-13-2005

Hi!

I am wondering what is the best way to control that compiler manage
variable names longer then 8 signs.
Does it enought to set 2 variables with the same name and difference after
8 sign and se thats happends?
--
Thanx in advance!



______________________________________
I se the lightat the end, but every time I take a step it's get dim.
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      02-13-2005
Carramba <> writes:
> I am wondering what is the best way to control that compiler manage
> variable names longer then 8 signs.
> Does it enought to set 2 variables with the same name and difference
> after 8 sign and se thats happends?


You keep using the word "sign" when you mean "character". A sign is a
'+' or '-' character.

The C90 standard requires compilers to support internal identifiers of
at least 31 significant characters (case sensitive), and external
identifiers of at least 6 significant characters (possibly case
insensitive). C99 expands these limits to 63 and 31, respectively.

Most implementations support greater lengths than what the standard
requires, especially for internal identifiers.

It's vanishingly unlikely that you'll run into problems using
reasonable identifiers longer than 8 characters.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      02-13-2005
On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
<kst-> wrote:

>The C90 standard requires compilers to support internal identifiers of
>at least 31 significant characters (case sensitive), and external
>identifiers of at least 6 significant characters (possibly case
>insensitive). C99 expands these limits to 63 and 31, respectively.
>
>Most implementations support greater lengths than what the standard
>requires, especially for internal identifiers.
>
>It's vanishingly unlikely that you'll run into problems using
>reasonable identifiers longer than 8 characters.


I ran into this about a decade ago, porting a Unix app to DOS. The idiot
that wrote the original used immensely annoying function names like

ConvertTexToDVIFormatLittleEndianQuadWord
ConvertTexToDVIFormatLittleEndian2ByteWord

and so on.....

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-14-2005
Mark McIntyre wrote:
> Keith Thompson <kst-> wrote:
>

.... snip ...
>>
>> It's vanishingly unlikely that you'll run into problems using
>> reasonable identifiers longer than 8 characters.

>
> I ran into this about a decade ago, porting a Unix app to DOS. The idiot
> that wrote the original used immensely annoying function names like
>
> ConvertTexToDVIFormatLittleEndianQuadWord
> ConvertTexToDVIFormatLittleEndian2ByteWord
>
> and so on.....


Which is where my utility id2id would come in. One list of oldname
newname pairs could be used to revise every file in the system.
Ids are limited to 40 chars, but easily changed with a #define.
See:

<http://cbfalconer.home.att.net/download/id2id-20.zip>

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson


 
Reply With Quote
 
Randy Howard
Guest
Posts: n/a
 
      02-14-2005
In article <>,
says...
> Mark McIntyre wrote:
> > Keith Thompson <kst-> wrote:
> >

> ... snip ...
> >>
> >> It's vanishingly unlikely that you'll run into problems using
> >> reasonable identifiers longer than 8 characters.

> >
> > I ran into this about a decade ago, porting a Unix app to DOS. The idiot
> > that wrote the original used immensely annoying function names like
> >
> > ConvertTexToDVIFormatLittleEndianQuadWord
> > ConvertTexToDVIFormatLittleEndian2ByteWord
> >
> > and so on.....

>
> Which is where my utility id2id would come in. One list of oldname
> newname pairs could be used to revise every file in the system.
> Ids are limited to 40 chars, but easily changed with a #define.
> See:
>
> <http://cbfalconer.home.att.net/download/id2id-20.zip>


Seems like cscope could do this a long time ago, and you didn't have
to make a list ahead of time, you did it interactively.

I haven't looked at the details of your package, just the description
above.

If you wanted to batch it, wouldn't sed do the job?



--
Randy Howard (2reply remove FOOBAR)
"Making it hard to do stupid things often makes it hard
to do smart ones too." -- Andrew Koenig
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-14-2005
Randy Howard wrote:
> says...
>> Mark McIntyre wrote:
>>> Keith Thompson <kst-> wrote:
>>>

>> ... snip ...
>>>>
>>>> It's vanishingly unlikely that you'll run into problems using
>>>> reasonable identifiers longer than 8 characters.
>>>
>>> I ran into this about a decade ago, porting a Unix app to DOS.
>>> The idiot that wrote the original used immensely annoying
>>> function names like
>>>
>>> ConvertTexToDVIFormatLittleEndianQuadWord
>>> ConvertTexToDVIFormatLittleEndian2ByteWord
>>>
>>> and so on.....

>>
>> Which is where my utility id2id would come in. One list of oldname
>> newname pairs could be used to revise every file in the system.
>> Ids are limited to 40 chars, but easily changed with a #define.
>> See:
>>
>> <http://cbfalconer.home.att.net/download/id2id-20.zip>

>
> Seems like cscope could do this a long time ago, and you didn't have
> to make a list ahead of time, you did it interactively.
>
> I haven't looked at the details of your package, just the description
> above.
>
> If you wanted to batch it, wouldn't sed do the job?


id2id is a filter, it reads the file once, and makes all the
changes in a single pass. It is also reversible under mild
restrictions. So you can easily apply it to a whole set of files.
You also have a record of the changes, so you can go back and
change your mind easily.

I think I should change the identifier length to 64 to agree with
C99.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

 
Reply With Quote
 
Carramba
Guest
Posts: n/a
 
      02-14-2005
On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <kst-> wrote:

> Carramba <> writes:
>> I am wondering what is the best way to control that compiler manage
>> variable names longer then 8 signs.
>> Does it enought to set 2 variables with the same name and difference
>> after 8 sign and se thats happends?

>
> You keep using the word "sign" when you mean "character". A sign is a
> '+' or '-' character.


Iam sorry for my poor english, Iam trying my best.

> The C90 standard requires compilers to support internal identifiers of
> at least 31 significant characters (case sensitive), and external
> identifiers of at least 6 significant characters (possibly case
> insensitive). C99 expands these limits to 63 and 31, respectively.
>
> Most implementations support greater lengths than what the standard
> requires, especially for internal identifiers.
>
> It's vanishingly unlikely that you'll run into problems using
> reasonable identifiers longer than 8 characters.


thanx for answer, but Iam not affraid of runing into this proglem, it only
for educational purpose. So my questions stil unanswered?!
would it work to assgin first variable with 8 characters in lenght name
value, and then assign different value to 8+ long variable and call the
first one? should compiler (theoreticly) re-assign second value to first
variable if it coudn't hanle londer then 8 chars variable names?

ex
char Test_var;
char Test_variable;
Test_var='Y';
Test_varibla='N';
printf("In case of sussces you se Y & N , otherwise N & N\n%c & %c",
Test_var, Test_variable);

should something like that work?



--
Thanx in advance!



______________________________________
I se the lightat the end, but every time I take a step it's get dim.
 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      02-14-2005
On Mon, 14 Feb 2005 07:08:11 +0100, Carramba <> wrote
in comp.lang.c:

> On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <kst-> wrote:
>
> > Carramba <> writes:
> >> I am wondering what is the best way to control that compiler manage
> >> variable names longer then 8 signs.
> >> Does it enought to set 2 variables with the same name and difference
> >> after 8 sign and se thats happends?

> >
> > You keep using the word "sign" when you mean "character". A sign is a
> > '+' or '-' character.

>
> Iam sorry for my poor english, Iam trying my best.
>
> > The C90 standard requires compilers to support internal identifiers of
> > at least 31 significant characters (case sensitive), and external
> > identifiers of at least 6 significant characters (possibly case
> > insensitive). C99 expands these limits to 63 and 31, respectively.
> >
> > Most implementations support greater lengths than what the standard
> > requires, especially for internal identifiers.
> >
> > It's vanishingly unlikely that you'll run into problems using
> > reasonable identifiers longer than 8 characters.

>
> thanx for answer, but Iam not affraid of runing into this proglem, it only
> for educational purpose. So my questions stil unanswered?!
> would it work to assgin first variable with 8 characters in lenght name
> value, and then assign different value to 8+ long variable and call the
> first one? should compiler (theoreticly) re-assign second value to first
> variable if it coudn't hanle londer then 8 chars variable names?
>
> ex
> char Test_var;
> char Test_variable;
> Test_var='Y';
> Test_varibla='N';
> printf("In case of sussces you se Y & N , otherwise N & N\n%c & %c",
> Test_var, Test_variable);
>
> should something like that work?


EVERY C compiler is required by the C standard to document its limits
on names, both for internal use within a single file and for external
linkage.

Why don't you just read your compiler's documentation?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      02-14-2005
Carramba <> writes:
> On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <kst-> wrote:

[...]
> thanx for answer, but Iam not affraid of runing into this proglem, it
> only for educational purpose. So my questions stil unanswered?!
> would it work to assgin first variable with 8 characters in lenght
> name value, and then assign different value to 8+ long variable and
> call the first one? should compiler (theoreticly) re-assign second
> value to first variable if it coudn't hanle londer then 8 chars
> variable names?
>
> ex
> char Test_var;
> char Test_variable;
> Test_var='Y';
> Test_varibla='N';
> printf("In case of sussces you se Y & N , otherwise N & N\n%c & %c",
> Test_var, Test_variable);
>
> should something like that work?


Test_var and Test_variable appear to be internal identifiers, so
they're absolutely guaranteed by both C90 and C99 to be distinct.
Unless you're using external identifiers, you can always count on 31
significant characters. Your implementation is required to document
what its actual limit is.

If you had something like this:

char this_is_a_very_long_identifier_1; /* 32 characters long */
char this_is_a_very_long_identifier_2;
this_is_a_very_long_identifier_1 = 'Y';
this_is_a_very_long_identifier_2 = 'N';

you could conceivably run into problems on an implementation that
actually limits identifers to 31 significant characters. The standard
says that "If two identifiers differ only in nonsignificant
characters, the behavior is undefined", so there's no way to tell what
the program is going to do.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Chris Croughton
Guest
Posts: n/a
 
      02-14-2005
On Sun, 13 Feb 2005 23:39:09 +0000, Mark McIntyre
<> wrote:

> On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
> <kst-> wrote:
>
>>The C90 standard requires compilers to support internal identifiers of
>>at least 31 significant characters (case sensitive), and external
>>identifiers of at least 6 significant characters (possibly case
>>insensitive). C99 expands these limits to 63 and 31, respectively.
>>
>>Most implementations support greater lengths than what the standard
>>requires, especially for internal identifiers.
>>
>>It's vanishingly unlikely that you'll run into problems using
>>reasonable identifiers longer than 8 characters.

>
> I ran into this about a decade ago, porting a Unix app to DOS. The idiot
> that wrote the original used immensely annoying function names like
>
> ConvertTexToDVIFormatLittleEndianQuadWord
> ConvertTexToDVIFormatLittleEndian2ByteWord


I shoot that sort of programmer on sight. Quite apart from portability
issues, it makes the program less readable and thus more error prone
(statements tend to straggle over lots of lines, or lines are
ridiculously long). When programmers also use "Hungarian" notation it's
far kinder to put them out of everyone's misery...

(I did my first programming in FORTRAN IV, where we had at most 6
characters for names, case insensitive. And then I went on to Unix
where a command name with more than three characters was considered too
much to type...)

Chris C
 
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
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Advice needed: Best way to deploy/manage SQL db website Bobby Edward ASP .Net 7 02-22-2008 02:37 PM
what is the best way to manage about 2000 database connection / mssql+ asp.net laziers@gmail.com ASP .Net 4 12-01-2007 08:45 PM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
Best way to manage. catalogue and store photos?? PeterH Digital Photography 8 01-05-2005 03:52 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57