473,804 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Variable Length

lak
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
It accepts it.Then what is the maximum length to a variable name.?

Nov 3 '07
13 7814
"Tor Rustad" <to********@hot mail.comwrote in message
>
Yes, 6 significant initial characters it was.

I beleave one of our major production systems, still have that
limitation. This limit resulted in some terrible naming conventions.
The rule of six.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Nov 3 '07 #11
James Kuyper wrote:
lak wrote:
>I want to know what is the variable length in c. I K&R they
stated that atleast 31 character. But I give 1 lakhs length to
a variable, but my compiler doesn't say any error. It accepts
it. Then what is the maximum length to a variable name.?

The limit is on identifiers, not just variable names; function
names, for instance, are also identifiers.

The 31 character limit is only on external identifiers. Internal
identifiers have a limit of 63 (5.2.4p1).

That limit is a minimum, not a maximum. "There is no specific
limit on the maximum length of an identifier." (6.4.1p2).
That minimum, in C, depends on the standard in effect. For C89,
C90, C95 I believe it is smaller. However, in practice you can
always depend on 10 to 16 chars barring the use of ancient
compilers and linkers. Use of longer names is generally foolish.

--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home .att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 3 '07 #12
Malcolm McLean wrote:
"Tor Rustad" <to********@hot mail.comwrote in message
>>
Yes, 6 significant initial characters it was.

I beleave one of our major production systems, still have that
limitation. This limit resulted in some terrible naming conventions.
The rule of six.
Identifiers prefixed with letter + 5 digits, or 3 letters + 3 digits. :)

--
Tor <bw****@wvtqvm. vw | tr i-za-h a-z>
Nov 3 '07 #13
On Sat, 03 Nov 2007 10:32:18 -0700, Keith Thompson <ks***@mib.or g>
wrote:
lak <la********@gma il.comwrites:
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
It accepts it.Then what is the maximum length to a variable name.?

The C90 standard requires compilers to support a minumum of 31
significant initial characters in an internal identifier or macro
name, 6 in an external identifier. I recall that external identifiers
that differ only in case ("foo" vs. "Foo") are not required to be
treated as distinct, but in a quick look at the C90 standard I didn't
find a reference to that.
6.1.2 under Implementation Limits
C99 increases this to 63 characters for internal identifiers, 31 for
external identifiers. I believe that identifiers differing only in
case are required to be treated as distinct, but again, I didn't find
a reference to that in the standard (I'm sure it's there, I just
didn't take the time to find it).
It's no longer there explicitly; just the general statement in 6.4.2.1
that any difference within the limit (31 or 63) is a different
identifier, WITHOUT an exception for case-folding.
However, compilers aren't required to impose these restrictions; <snip>
- formerly david.thompson1 || achar(64) || worldnet.att.ne t
Nov 19 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2754
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid = server.createobject("scriptlet.typelib").guid guid=Left(guid,instr(guid,"}")) genguid=guid
4
2591
by: sylvain.loiseau | last post by:
Hello Given a node set, I try to compute the total of the string-length value of each node. For instance, with : <xsl:for-each select="//q"> <!-- the length of each node is compute with: --> <xsl:value-of select="string-length(.)" />
5
11745
by: MLH | last post by:
I'm working with lots of long strings now, it seems. I have to import them & parse them constantly. The A97 memo field type supports only 32768 chars. What happens when this is processed... Dim MyString As String Am I getting VLS declaration or a FLS declaration? Can I control which I get somehow? I have done some homework, but I don't understand
5
14116
by: dam_fool_2003 | last post by:
Hai, I studied that the array size is fixed. But I come across a word called "variable length array". Is it possible to change the array size? So I tried the following: #include<stdio.h> #include<stdlib.h> int main(void) { int y = { 7, 9,10},i; for (;i<20;i++)
18
9403
by: Panchal V | last post by:
I want to access a variable length record in C, the format is as follows : +---+---+-----------+ | A | L | D A T A | +---+---+-----------+ A - Some Data (1 BYTE) L - Length the Data that follows (1 BYTE) then actual data
14
5850
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I want to store data like a database: ---------------------------------- Custumer:
19
2149
by: Skybuck Flying | last post by:
Hi, I think I might have just invented the variable bit cpu :) It works simply like this: Each "data bit" has a "meta data bit". The meta data bit describes if the bit is the ending bit of a possibly large structure/field.
8
3515
by: chellappa | last post by:
hi Everybody ! decalaring variable in a.h and using that vaaariable in a1.c and inalization is in main.c it is possible .........pleaase correct that error is it Possible? i am trying it gives error! In file included from main.c:2: a1.c:3: error: initializer element is not constant
6
2712
by: foreverbored75 | last post by:
Hello All! I am just learning c++ in school and I have the following question: Is there a way for the user to input the length of an array (console application) without using another variable? I made this program that finds the average of x number of numbers and stores the average in the last index of the array of the numbers. The other other variable I have is to determine the length of the array (totalNums). Is there a way to get...
3
4060
by: chandra.krothapalli | last post by:
Hi, I am writing a program to read database logs using db2Readlog/ db2ReadLogNoConn API. I am able to parse the data of "FIXED format data" and link them to appropriate columns for a given UPDATE/INSERT/DELETE. I am having difficulty in parsing the "Variable format data". In the log record I am not able find information about data length of each
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.