You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C and C++ have a hard time with zero-sized types, they're basically not possible without special compiler extensions as far as I can tell? However, the following Rust code compiles fine without any warnings:
How do we currently handle this (as far as I can tell, they're just ignored)? Do we want to make any guarantees about how they work? Are there any calling conventions that reserve "space" for zero-sized arguments?
(I have a little bit of a use-case for this: In objc2, it would make the API slightly nicer to be able to "act" as-if a function took a specific zero-sized marker type MainThreadMarker).
If this is UB, I think we should at least extend the improper_c_types lint to warn on zero-sized arguments.
The text was updated successfully, but these errors were encountered:
madsmtm
changed the title
Calling extern "C" fn with zero-sized argument?extern "C" fn with zero-sized argument?
Jun 8, 2022
C and C++ have a hard time with zero-sized types, they're basically not possible without special compiler extensions as far as I can tell? However, the following Rust code compiles fine without any warnings:
How do we currently handle this (as far as I can tell, they're just ignored)? Do we want to make any guarantees about how they work? Are there any calling conventions that reserve "space" for zero-sized arguments?
(I have a little bit of a use-case for this: In
objc2
, it would make the API slightly nicer to be able to "act" as-if a function took a specific zero-sized marker typeMainThreadMarker
).If this is UB, I think we should at least extend the
improper_c_types
lint to warn on zero-sized arguments.The text was updated successfully, but these errors were encountered: