此代码片段是从XCB 中事件的最后一个教程示例复制而来的:
01 xcb_generic_event_t *event;
02 while ( (event = xcb_wait_for_event (connection)) ) {
03 switch (event->response_type & ~0x80) {
04 case XCB_EXPOSE: {
05 xcb_expose_event_t *expose = (xcb_expose_event_t *)event;
06 printf ("Window %"PRIu32" exposed. Region to be redrawn at location (%"PRIu16",%"PRIu16"), with dimension (%"PRIu16",%"PRIu16")\n",
07 expose->window, expose->x, expose->y, expose->width, expose->height );
08 break;
09 }
在第 5 行中,指针xcb_generic_event_t
被类型转换为指针xcb_expose_event_t
,这是在标准 C 语言中进行此类操作的好方法吗?并请解释它的含义是什么?