By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,042 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,042 IT Pros & Developers. It's quick & easy.

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

P: n/a

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.
Nov 14 '05 #1
Share this Question
Share on Google+
18 Replies


P: n/a
Carramba <no****@privet.net> 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) ks***@mib.org <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.
Nov 14 '05 #2

P: n/a
On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
<ks***@mib.org> 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 =----
Nov 14 '05 #3

P: n/a
Mark McIntyre wrote:
Keith Thompson <ks***@mib.org> 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
Nov 14 '05 #4

P: n/a
In article <42***************@yahoo.com>, cb********@yahoo.com
says...
Mark McIntyre wrote:
Keith Thompson <ks***@mib.org> 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
Nov 14 '05 #5

P: n/a
Randy Howard wrote:
cb********@yahoo.com says...
Mark McIntyre wrote:
Keith Thompson <ks***@mib.org> 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

Nov 14 '05 #6

P: n/a
On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <ks***@mib.org> wrote:
Carramba <no****@privet.net> 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.
Nov 14 '05 #7

P: n/a
On Mon, 14 Feb 2005 07:08:11 +0100, Carramba <no****@privet.net> wrote
in comp.lang.c:
On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <ks***@mib.org> wrote:
Carramba <no****@privet.net> 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
Nov 14 '05 #8

P: n/a
Carramba <no****@privet.net> writes:
On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <ks***@mib.org> 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) ks***@mib.org <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.
Nov 14 '05 #9

P: n/a
On Sun, 13 Feb 2005 23:39:09 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote:
On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
<ks***@mib.org> 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
Nov 14 '05 #10

P: n/a
Mark McIntyre <ma**********@spamcop.net> wrote:
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


Must've been a PasCal ProGrammer.

Richard
Nov 14 '05 #11

P: n/a
In article <p3********************************@4ax.com>, Mark McIntyre
<ma**********@spamcop.net> writes
On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
<ks***@mib.org> 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.....


Surely that converts to

ConvertTexToDVIFormatLittleEndia
and
ConvertTexToDVIFormatLittleEndia

after going through the compiler? :-)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Nov 14 '05 #12

P: n/a
Chris Hills <ch***@phaedsys.org> writes:
In article <p3********************************@4ax.com>, Mark McIntyre
<ma**********@spamcop.net> writes

[...]
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.....


Surely that converts to

ConvertTexToDVIFormatLittleEndia
and
ConvertTexToDVIFormatLittleEndia

after going through the compiler? :-)


Not necessarily. C99 6.4.2.1p6 says:

Any identifiers that differ in a significant character are
different identifiers. If two identifiers differ only in
nonsignificant characters, the behavior is undefined.

so they don't necessarily just truncate. C90 has identical wording
(but different minimum limits).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Nov 14 '05 #13

P: n/a
On Mon, 14 Feb 2005 16:42:01 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:
Mark McIntyre <ma**********@spamcop.net> wrote:
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


Must've been a PasCal ProGrammer.


You're spot on, or pretty close anyway. An Academic.
--
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 =----
Nov 14 '05 #14

P: n/a
On Mon, 14 Feb 2005 01:16:32 -0600, Jack Klein <ja*******@spamcop.net>
wrote:
On Mon, 14 Feb 2005 07:08:11 +0100, Carramba <no****@privet.net> wrote
in comp.lang.c:
On Sun, 13 Feb 2005 21:56:03 GMT, Keith Thompson <ks***@mib.org> wrote:
> Carramba <no****@privet.net> 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?


it's wasn't my point to prov if compiler supports or don't long names, I
was asking if my way would by enought to test it.
I have no intension to writte meningles long names it's only for
educational purpose only.

--
Thanx in advance!

;-)

______________________________________
I se the lightat the end, but every time I take a step it's get dim.
Nov 14 '05 #15

P: n/a
Mark McIntyre wrote:
On Sun, 13 Feb 2005 21:56:03 GMT, in comp.lang.c , Keith Thompson
<ks***@mib.org> wrote:

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


This is yet another place where Hungarian Notation would come in handy
- if he'd used

leqwTe2DVCvt for ConvertTexToDVIFormatLittleEndianQuadWord

and lewTe2DVCvt for ConvertTexToDVIFormatLittleEndian2ByteWord

you wouldn't have had the problem, plus the code is self documenting.

Zog.

Nov 14 '05 #16

P: n/a
"kingzog" <ki*******@lycos.com> writes:
This is yet another place where Hungarian Notation would come in handy
- if he'd used

leqwTe2DVCvt for ConvertTexToDVIFormatLittleEndianQuadWord

and lewTe2DVCvt for ConvertTexToDVIFormatLittleEndian2ByteWord

you wouldn't have had the problem, plus the code is self documenting.


I hope that's meant to be sarcastic.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #17

P: n/a
Carramba <no****@privet.net> writes:
[..]
it's wasn't my point to prov if compiler supports or don't long names,
I was asking if my way would by enought to test it.


And the answer is no. Using identifiers that differ only in
nonsignificant characters (e.g., whose first N characters are
identical, where N is what the implementation guarantees) invokes
undefined behavior. That means there is no way to test it. An
implementation that guarantees, say, 63 significant initial characters
for internal identifiers could treat all distinct 1000-character
identifiers as distinct *unless* one of them contains the letter 'Q'.

It's typical, I think, for compilers either to internally truncate
long identifiers, or not to impose any fixed limit at all, but that's
not guaranteed.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Nov 14 '05 #18

P: n/a
On 15 Feb 2005 06:58:37 -0800, in comp.lang.c , "kingzog"
<ki*******@lycos.com> wrote:
This is yet another place where Hungarian Notation would come in handy
- if he'd used

leqwTe2DVCvt for ConvertTexToDVIFormatLittleEndianQuadWord

and lewTe2DVCvt for ConvertTexToDVIFormatLittleEndian2ByteWord

you wouldn't have had the problem, plus the code is self documenting.


The hit squad are on their way. I trust youv'e made a will....

=;-0
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
Nov 14 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.