ARM Technical Support Knowledge Articles

ERROR 166 (ARRAY OF FUNCTIONS)

Applies to: C51 C Compiler

Answer

Information in this article applies to:


SYMPTOMS

Does the C51 Compiler support arrays of functions? I get the following error when I try to do that:

Error 166:  'some_functions': array of functions

My program appears as follows:

void function1( void );
void function2( void );
/* ... */
void function39( void );

code void (*some_functions)(void)[] = {
    function1,
    function2,
    /* ... */
    function39
};

What's going on?

CAUSE

C supports arrays of function pointers. It does not support arrays of functions. The declaration you have for the array is close but it is not quite correct.

RESOLUTION

Change your declaration to the following:

code void (code * some_functions []) (void) = { ...

MORE INFORMATION

For more information, refer to Application Note 129.

Article last edited on: 2005-09-22 12:17:52

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential