On ILP_32 architectures, the integer 0 is not discernible from the (void *)0 (aka NULL) and so most compilers don't bother to issue a warning. This comes from an age where programmers were expected to know how computers work on an assembly language level and would "know what they are doing" when passing an integer of the same size to a pointer argument.
On LP_64 architactures, the integer 0 is 32 bits while (void *)0 is 64 bits, which makes more than a bit of a difference. A 64 bit integer 0 would be denoted by 0L. Additionally, compilers have become more pedantic (because compiler builders have become aware of the fact that not "knowing what you are doing" in respect to pointers and integers is a common source of errors) and will complain about "making a pointer from an integer of a different size" and/or "making a pointer from an integer without a cast". There are many casese of 0 vs. NULL in sqlite code; they do not, however, influence the operation of the code, just compileability in "nit picking" mode. -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Clemens Ladisch Gesendet: Donnerstag, 26. Jänner 2017 08:47 An: sqlite-users@mailinglists.sqlite.org Betreff: Re: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit Ziemowit Laski wrote: > Visual C++ Which one? > correctly catches this. Oh? What exactly is illegal about this? > struct IcuScalar { > const char *zName; /* Function name */ > int nArg; /* Number of arguments */ > int enc; /* Optimal text encoding */ > void *pContext; /* sqlite3_user_data() context > */ > void (*xFunc)(sqlite3_context*,int,sqlite3_value**); > } scalars[] = { > ... > {"icu_load_collation", 2, SQLITE_UTF8, (void*)db, icuLoadCollation}, > }; > > should read > > } scalars[] = { > ... > { "icu_load_collation", 2, SQLITE_UTF8, 0, icuLoadCollation } > }; > > scalars[11].pContext = (void*)db; Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: h...@scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users