Greeting to Everyone,
I have been asked by my friend the explanation of the usage and functionality of this typedefbut it seems complicated to me as well.Code:(highlighted as //Issue01)
At this point, I don't understand how will this typedef works? Is it just associating a nameCode:#define INDEX_MASK 0x0000FFFF typedef struct { U8 data[4]; U16 crc; } term_sf_param; typedef const struct term_titem_par_s { term_titype_t itype; void* p_val; term_limits_t lim; U32 identifier; } term_titem_par_t, *term_pitem_par; typedef const struct _term_titem_s { term_titype_t itype; } term_titem_t, *term_pitem; static term_sf_param *para_set0 = NULL; term_sf_param term_set_get(term_pitem p_item_new) { term_sf_param par0 = para_set0[((term_pitem_par)p_item_new)->identifier & INDEX_MASK]; //Issue02 return par0; } typedef S16 (*ifunci)(S16); typedef ifunci const *term_titype_t; //Issue01 typedef struct { U8 data[4]; U16 crc; } term_sf_param;to function pointerCode:"const *term_titype_t"?? It does sound unclear and some part may be in typedef I have either missed or not understood completely.. can anybody explain how this thing works?Code:"S16 (*ifunci)(S16)"
Additionally in function, the input argument is "p_item_new" whose datatype is "term_pitem". Inside the function, that same argument is typecasted with structureCode:"term_set_get"and based on the values, it updates "para_set0".Code:"term_pitem_par"
It seems awkward as. Would be doing that is correct? Is this concept related to data hiding (its my assumption) as I have never encountered this type casting before.Code:sizeof(term_pitem) < sizeof(term_pitem_par)
Any link or description related to my problem will also be appreciable.
Thanks in advance..