GENERAL: INDIRECT FUNCTION CALL SYNTAX
Information in this article applies to:
I have noticed that functions can be called indirectly using the following syntax:
Is there a difference between the two methods? Should I use one in favor of the other? Will one of them cause any problems? Is this a mistake in the compiler?
Both methods are legal. The method that uses the indirection operator is the older one and ANSI C supports that method for purposes of compatibility with older compilers.
The following is the assembly code generated by the C51 compiler for both methods:
93 1 fptr(); 0000 AA00 R MOV R2,fptr+01H 0002 A900 R MOV R1,fptr+02H 0004 120000 E LCALL ?C?ICALL 94 1 (*fptr)(); 0007 AA00 R MOV R2,fptr+01H 0009 A900 R MOV R1,fptr+02H 000B 120000 E LCALL ?C?ICALL
As you can see, they are identical. The choice of which method to use is a personal preference.
Last Reviewed: Thursday, June 10, 2004
of your data.