News for hackers. Stuff that matters.
Re:Announcing TypeScript 0.9.1 by nly on Wednesday August 07, 2013 @08:23AM (#6172275)
void* is used in practically every C library that offers a callback facility.
Re:Announcing TypeScript 0.9.1 by harrytuttle on Wednesday August 07, 2013 @09:04AM (#6172496)
Almost...

You have a typed pointer to a function but that's not a void pointer and the "New C Standard" 6.3.2.3 states that you can't cast a function pointer to a void*.

Re:Announcing TypeScript 0.9.1 by ygra on Wednesday August 07, 2013 @09:21AM (#6172595)
Not for function pointers; for passing data to callbacks that can be any type.
Re:Announcing TypeScript 0.9.1 by harrytuttle on Wednesday August 07, 2013 @09:23AM (#6172614)
Can you provide an example? Not 100% sure in which context you are talking about.
Re:Announcing TypeScript 0.9.1 by ygra on Wednesday August 07, 2013 @09:54AM (#6172801)
As an example, SQLite:

    int sqlite3_exec(
      sqlite3*,                                  /* An open database */
      const char *sql,                           /* SQL to be evaluated */
      int (*callback)(void*,int,char**,char**),  /* Callback function */
      void *,                                    /* 1st argument to callback */
      char **errmsg                              /* Error msg written here */
    );
Here the void * is an argument that is passed in the callback as well so that you can update your own struct with the result, for example. Singe the library cannot know anything about your types, void * is the only option.
Re:Announcing TypeScript 0.9.1 by harrytuttle on Wednesday August 07, 2013 @11:52AM (#6173599)
Thanks for the example. Agree entirely then :)