Skip to contentSkip to conversation

bpf: Change structure passing and assignment

DISCUSSION Karim Eshapa 2 participants 2 messages Jan 13, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I noticed that most of functions here have structure arguements and return structure, all these structures passed and returned are delt in passing and assignment like memcpy a structure.In addition it takes size in stack while passing. so why not we use pointers to structure as argumentsor there is actual need to do such things and you intentionaly want to deal with copies of strucuteres. ex:
struct tnum tnum_add(struct tnum a, struct tnum b)
{

}

Thanks,
Karim

#1 lore raw
Quoted 3 lines · Karim Eshapa

I noticed that most of functions here have structure arguements and return structure, all these structures passed and returned are delt in passing and assignment like memcpy a structure.In addition it takes size in stack while passing. so why not we use pointers to structure as argumentsor there is actual need to do such things and you intentionaly want to deal with copies of strucuteres. ex:
struct tnum tnum_add(struct tnum a, struct tnum b)

and how an alternative for the above would look like with pointers ?