tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Testing with ASan and Valgrind


From: Stephan Beal
Subject: Re: [Tinycc-devel] Testing with ASan and Valgrind
Date: Sat, 7 Nov 2015 19:33:31 +0100

On Sat, Nov 7, 2015 at 5:39 PM, grischka <address@hidden> wrote:
Edmund Grimley Evans wrote:
Last night I pushed a few commits to fix bugs uncovered by ASan and
Valgrind. Comments and criticisms are welcome.

- tccgen.c: Fix memory leak involving asm_label.
It would be better to record the asm_label as its (int) token numher.


- cstr.data = "" (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).

http://stackoverflow.com/questions/9894013/is-null-always-zero-in-c

FWIW, sqlite3 (which is C89-compatible except for its use of (long long)) uses 0 exclusively (or almost so) instead of NULL.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]