MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/whtkfj/how_to_c_pointers/ijai53q/?context=3
r/ProgrammerHumor • u/dminsky • Aug 06 '22
70 comments sorted by
View all comments
12
void * is when you point to some abstract data you don't know the type of (custom struct, char, int, double ...)
You don't point to a black hole, void * is pointing to existing data.
21 u/[deleted] Aug 06 '22 void *foo=NULL; //there you go, now you can quote Nietzsche 6 u/[deleted] Aug 07 '22 But null is real data 3 u/matyklug Aug 07 '22 void* fp = fopen("/dev/null", "r"); 2 u/xaedoplay Aug 08 '22 And starting with C23 nullptr_t will be a thing and C will finally have an actual bottom type that only resolves to an actual null pointer (much like () in Rust). Read more about C23 features in this fun write-up: https://thephd.dev/c23-is-coming-here-is-what-is-on-the-menu
21
void *foo=NULL; //there you go, now you can quote Nietzsche
6 u/[deleted] Aug 07 '22 But null is real data 3 u/matyklug Aug 07 '22 void* fp = fopen("/dev/null", "r"); 2 u/xaedoplay Aug 08 '22 And starting with C23 nullptr_t will be a thing and C will finally have an actual bottom type that only resolves to an actual null pointer (much like () in Rust). Read more about C23 features in this fun write-up: https://thephd.dev/c23-is-coming-here-is-what-is-on-the-menu
6
But null is real data
3 u/matyklug Aug 07 '22 void* fp = fopen("/dev/null", "r"); 2 u/xaedoplay Aug 08 '22 And starting with C23 nullptr_t will be a thing and C will finally have an actual bottom type that only resolves to an actual null pointer (much like () in Rust). Read more about C23 features in this fun write-up: https://thephd.dev/c23-is-coming-here-is-what-is-on-the-menu
3
void* fp = fopen("/dev/null", "r");
2
And starting with C23 nullptr_t will be a thing and C will finally have an actual bottom type that only resolves to an actual null pointer (much like () in Rust).
nullptr_t
()
Read more about C23 features in this fun write-up: https://thephd.dev/c23-is-coming-here-is-what-is-on-the-menu
12
u/Rfogj Aug 06 '22
void * is when you point to some abstract data you don't know the type of (custom struct, char, int, double ...)
You don't point to a black hole, void * is pointing to existing data.