"Ron Natalie" <ro*@sensor.com> wrote in message
news:3f***********************@news.newshosting.co m...
"William Payne" <mi******************@student.liu.se> wrote in message
news:bs*********@news.island.liu.se... foo(&inst); /* Does standard C++ require a void* cast here? */
No, any object pointer can be implicitly converted to void*.
The reverse is not true.
Note that pointers to any sort of member or function are not
convertible to void*.
Thank you, Ron. I noticed in some code in a book that a pointer to a struct
was being cast to char* in a call to a function that was expecting a void*.
I changed from char*-cast to void*-cast and both worked and then I removed
the cast altogether and it still worked. And I mean works as no compile-time
or run-time errors. Just wanted to make sure I wasn't relying on some
dubious behaviour allowed by my compiler. Wonder why the author of the book
saw fit to cast to char* though...
/ William Payne