> - cstr.data = 0; (and others) > Use NULL. (This is not C++)
> According to my understanding (and to StackOverflow), a constant of 0 _is_ a > NULL pointer, but NULL is not always 0 (its bit pattern may differ). See also http://c-faq.com/null/nullor0.html or google for "c null faq". I find NULL looks ugly and old-fashioned and I would hate to have to type it. It doesn't have any practical advantage that I know of. If this were C++ we'd use nullptr, of course: even longer, but at least no shift key is involved. Using 0 rather than NULL is perfectly correct even if the system doesn't use zero bits to represent a null pointer. However, a system that didn't use zero bits to represent a null pointer would not work with much of today's C software. For example, it took me about 30 seconds to find a place in tinycc where it is assumed that you can initialise a pointer using memset. Although initialising a pointer with memset is not officially correct according to the C standard, you would be unlikely to improve the portability of your software in practice by abstaining from the practice, and the code with memset may be easier to read and maintain (and perhaps run faster if you have a not-very-clever compiler). Edmund _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
