[Buildroot] Analysis results for 2018-10-09

Peter Korsgaard peter at korsgaard.com
Thu Oct 11 12:46:53 UTC 2018


>>>>> "Baruch" == Baruch Siach <baruch at tkos.co.il> writes:

 > Hi Peter,
 > Peter Korsgaard writes:
 >>>>>>> "Baruch" == Baruch Siach <baruch at tkos.co.il> writes:
 >> >> -typedef double hbase_f(double);
 >> >> +typedef double (*hbase_f)(double);
 >> 
 >> > Wouldn't that make the definition 'hbase_f *val_in' a pointer to
 >> > function pointer?
 >> 
 >> Not in C at least. The syntax is:
 >> 
 >> typedef <returntype> (*name)(<arguments>)
 >> 
 >> https://stackoverflow.com/questions/1591361/understanding-typedefs-for-function-pointers-in-c

 > Correct. But consider the SO example code:

 >   typedef void (*SignalHandler)(int signum);

 >   extern SignalHandler signal(int signum, SignalHandler handler);

 > The 'handler' parameter of the signal() function is a pointer to a
 > function. However the definition

 >   SignalHandler *handler;

 > would create a pointer to a pointer. As I understand, this is not the
 > intention of the 'hbase_f *val_in' definition in the original code.

Ehh, yes - But I was talking about the typedef line (as quoted
above). The * is needed for typedef but not for the val_in definition.

-- 
Bye, Peter Korsgaard



More information about the buildroot mailing list