Reputation: 3
i am new with c++ and i have a piece of code below that i am unable to understand
from_net_fifos = new my_fifo_t <net_cmd_t> ** [NUM_PRIORITIES];
To be specific, I dont get what the ** means here.
I got this much from the code.
my_fifo_t
is a template, net_cmd_t
is a type which is a struct ,
the number of fifos created = number of priorities, ie each message with a different prirority has its own fifo queue. So basically we are creating fifo of type net_cmd_t, ie each element is of this struct type in the fifo. The number of fifos created equals the variable NUM_PRIORITIES
.
What does ** do here? Can someone correct me if i am wrong and explain the exact syntax of this line of code?
Upvotes: 0
Views: 112
Reputation: 409196
The asterisks *
are used to denote pointers, and the statement allocates NUM_PRIORITES
pointers to pointers to my_fifo_t
. You can think of it as an array of arrays of pointers to my_fifo_t
.
Upvotes: 5