Thread: why is i the standard counting variable?

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Also, there are still enough systems in use where the linker will only look at the first 6 or so characters of any variable, so veryLongVariable1 and veryLongVariable2 are indistinguishable.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by CornedBee
    Also, there are still enough systems in use where the linker will only look at the first 6 or so characters of any variable, so veryLongVariable1 and veryLongVariable2 are indistinguishable.
    Just for clarification, before everybody rushes to shorten all their variables, CornedBee's post was regarding external variables (those shared between files).

    In the context of a typical loop variable (ie. not external), I think the standard guaranteed minimum is 31 characters:
    Quote Originally Posted by C89 Draft
    The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:

    ...

    * 31 significant initial characters in an internal identifier or a macro name

    * 6 significant initial characters in an external identifier

  3. #18
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I wouldn't rush to shorten even my external variables. These systems have become very rare.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #19
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by CornedBee
    I wouldn't rush to shorten even my external variables. These systems have become very rare.
    ... and the point of the standard is that a compliant C compiler, on such a system, would be required to do things in a way that resolves concerns for the linker without requiring the programmer to change source code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. which variable can store words?
    By Hunterofman in forum C++ Programming
    Replies: 8
    Last Post: 04-28-2008, 05:59 PM
  2. global and static variable in a class delivered in a DLL
    By George2 in forum C++ Programming
    Replies: 16
    Last Post: 04-13-2008, 08:19 AM
  3. defaulting ifstream variable to standard input
    By risby in forum C++ Programming
    Replies: 16
    Last Post: 02-06-2008, 08:11 AM
  4. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  5. float/double variable storage and precision
    By cjschw in forum C++ Programming
    Replies: 4
    Last Post: 07-28-2003, 06:23 PM