Cannot understand the following codes
- From: gpsabove@xxxxxxxxx
- Date: 28 Mar 2006 13:47:29 -0800
I got problems on understanding the attached codes. It seems a 3rd
party API library is called.
Question1: Why assign NULL to GO_FUNCS?
Question2: GO_FUNCS looks like a struture of functions. Is there a
term for it?
Question 3: I cannot understand this line in total.
(*(void (*)
(int,t_go_measurements[]))(stGOFuncs.p_go_Measurements))(i_,ast_);
Why parenthesize an integer and a structure together?
What is possibly the type of stGOFuncs.p_go_Measurements? I did not see
its definition.
Why put void (*) ahead of the line?
I know these questions might seem silly to you, but please help. I also
want to get some links for this type of programming.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "goapi.hpp"
GO_FUNCS stGOFuncs =
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
void
go_Measurements(int i_, t_go_measurements ast_[])
{
(*(void (*)
(int,t_go_measurements[]))(stGOFuncs.p_go_Measurements))(i_,ast_);
}
//Find the definition of t_go_measurements in the header file
/*
* This structure holds a set of measurements
*/
typedef struct {
long lSpeed;
int iUnit;
...
double dDistance;
} t_go_measurements;
.
- Follow-Ups:
- Re: Cannot understand the following codes
- From: gpsabove
- Re: Cannot understand the following codes
- From: Ben C
- Re: Cannot understand the following codes
- From: Alf P. Steinbach
- Re: Cannot understand the following codes
- Prev by Date: Re: Neat Book: Theoretical Introduction to Programming" Hi People and any NLP Computers:
- Next by Date: Re: Opinions on a good choice for application re-write
- Previous by thread: Opinions on a good choice for application re-write
- Next by thread: Re: Cannot understand the following codes
- Index(es):