Post #1981547
2026-05-04 08:41 UTC
@typeswitch@gamedev.lgbt
Edit: Scratch that. They did officially add it in C23, in a pointlessly incompatible way with C++...
Why?
I am quite certain that typeof is an unstandardized extension, so no, this doesn't work in C.
That said, pointers are definitionally iterators according to C++'s definition if the term, so it's less an issue of not having them, than of lacking the language support to make their use nice.
Replies (1)
-
@erisceleste@tech.lgbt 2026-05-04 11:21
@Fiona typeof is the way that it is expressly for inter-language compatibility decltype chose a different keyword at the time it was introduced because C++ needs additional semantics that aren't in the GCC precedent and would retroactively break C if it was given that name the name was therefore intentionally left available by WG21 for the C Committee to do something with typeof can still be trivially implemented as a macro using features from if you need it for compatibility in C++ @typeswitch