Technical Support

C166: ?C_INITSEC AND ?C_CLRMEMSEC FUNCTIONS


Information in this article applies to:

  • C166 All Versions

QUESTION

What do the ?C_INITSEC and ?C_CLRMEMSEC functions do?

ANSWER

The ?C_INITSEC function initializes the global variables in your program. For example, if you program appears as follows:

unsigned long tens [] = { 1, 10, 100, 1000, 10000 };

unsigned long ten_power (unsigned char i)
{
return (tens[i]);
}

The tens array must be initialized with the values 1, 10, 100, and so on. This is what the ?C_INITSEC function does.

The ?C_CLRMEMSEC function clears uninitialized global variables to a value of 0 as defined by ANSI C.

  • If you have no global variables in your program, these functions are not called.
  • If you have only global variables that are initialized, ?C_INITSEC will be called but ?C_CLRMEMSEC will not.
  • If you have only global variables that are not initialized, ?C_CLRMEMSEC will be called but ?C_INITSEC will not.

There is no memory restriction for this section. It can reside anywhere in memory. That is also the reason why it does not belong to any memory class.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, April 16, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure