Syntax problem with struct and pointers
Posted: Mon Aug 10, 2020 6:03 pm
Hi,
I'm trying to use the interface "usb_ep0_callback_if" from the xmos usb lib. The function "get_interface_descriptor" of this interface has the weird parameter "const ep0_descriptor * unsafe &descs", I have no clue how to use. I am confused by using both operators together "*" and "&". "ep0_descriptor" is defined as:
I would expect, that I could use it like this:
Unfortunately, it does not work. What is the right syntax? It would help me, if you explain the syntax.
I'm trying to use the interface "usb_ep0_callback_if" from the xmos usb lib. The function "get_interface_descriptor" of this interface has the weird parameter "const ep0_descriptor * unsafe &descs", I have no clue how to use. I am confused by using both operators together "*" and "&". "ep0_descriptor" is defined as:
Code: Select all
typedef struct ep0_descriptor {
const char * unsafe desc;
size_t len;
} ep0_descriptor;
Code: Select all
size_t my_len = 20;
unsafe {
descs->desc = &my_array;
desc->len = &my_len;
}