Re:Tell HN: C Experts Panel – Ask us anything about C
by saagarjha on Tuesday April 14, 2020 @08:01PM
(#22872929)
Note that POSIX requires that object pointers and function pointers are the same for dlsym.
Re:Tell HN: C Experts Panel – Ask us anything about C
by loeg on Wednesday April 15, 2020 @02:30AM
(#22875160)
Surely you're not arguing that a bounded array is in fact a function rather than an object? The distinction between function and object pointers exists for Harvard architecture computers, which sort of exist (old Atmel AVR before they adopted ARM), but are not dominant.
There's no guarantee that a function pointer type can be converted to uintptr_t without loss of information.
C currently has two kinds of pointer types: object pointer types and function pointer types. "Fat pointers" could be a third. And since a fat pointer would internally be similar to a structure, converting it to or from an integer doesn't make a whole lot of sense. (If you want to examine the representation, you can use memcpy to copy it to an array of unsigned char.)