top | item 44428902

(no title)

el_pollo_diablo | 8 months ago

Sure, but your alternative code incorrectly assigns to (list)->payload. You have many other options. Without typeof, you can if(0) the assignment, or check type compatibility with a ternary operator like 1 ? (item) : (list)->payload and pass that to _list_prepend, etc. With typeof, you can store item in a temporary variable with the same type as (list)->payload, or build a compound literal (typeof(*(list))){.payload=(item)}, etc.

discuss

order

dhooper|8 months ago

The assignment is intentional. The union changed to a struct