Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI455.ASC

 
Output of file : TI455.ASC contained in archive : C_ALL.ZIP







PRODUCT : TURBO C NUMBER : 455
VERSION : 2.0
OS : PC-DOS
DATE : OCTOBER 31, 1988 PAGE : 1/3

TITLE : QUALIFYING VARIABLE NAMES




The subsection "Qualifying Variable Names" on page 57 of the
Turbo C User's Guide is inaccurate. Use the following
information as documentation:

There are three typical situations in which it is desirable to
fully qualify a variable name used in an expression.

o To qualify a static variable in another module, use the
following syntax:

..

o To qualify a local variable in a global function, use the
following syntax:

.

o To qualify a local variable in a static function, use the
following syntax:

...



The function name is only used when looking at a variable local
to the function. For example, suppose your program contains two
modules (FIRSTMOD, MYSUBS):


/* FIRSTMOD.C */
int a = 1;
main()
{
int b = 2;
myfunc();
printf("%d", i);
}

/* MYSUBS.C */
static int e = 3;
static void localfunc(void)
{
int d = 4;













PRODUCT : TURBO C NUMBER : 455
VERSION : 2.0
OS : PC-DOS
DATE : OCTOBER 31, 1988 PAGE : 2/3

TITLE : QUALIFYING VARIABLE NAMES




printf("End of the road\n");
}
void myfunc(void)
{
int c = 5;
localfunc();
}


To watch the global variable a, use:

a

To watch the local variable b in main, use:

main.b

To watch the local variable c in myfunc, use:

myfunc.c

To watch the local variable d in the static function localfunc,
use:

.mysubs.localfunc.d

To watch the static variable e in module2, use:

.mysubs.e


The necessity of qualifiers will depend on the current
instruction pointer. For instance, if your program is running in
main, it is unnecessary to qualify the variable b with the
function name main. Likewise, if your program is running inside
the MYSUBS module, it is unnecessary to qualify the variable e
with the module name.

Additionally, it is not possible to watch an auto (local) in an
inactive scope. Since the function myfunc calls localfunc, it is
possible to watch the local variables of myfunc from localfunc --
the variables in myfunc are not removed when localfunc is called.
However, once myfunc returns to main, it is no longer possible to













PRODUCT : TURBO C NUMBER : 455
VERSION : 2.0
OS : PC-DOS
DATE : OCTOBER 31, 1988 PAGE : 3/3

TITLE : QUALIFYING VARIABLE NAMES




view its local variables -- local variables are discarded when
the function in which they are located returns to the calling
function.

DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.











































  3 Responses to “Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI455.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/