jacob navia said:
C is for "macho" programmers that drink beer and
are just backwards.
This is of course YOUR opinion. I beg to differ.
That is nobody's opinion, and it has no resemblance to anything that
anyone in this thread has written. (jacob likes to make up nonsense
about what he thinks other people think. I've given up thinking that
he's ever going to stop this rude and dishonest behavior.)
[...]
The garbage collector imposes absolutely no
new language changes at all. You just use GC_malloc
instead of malloc, forget about free and link with
the provided library.
All this is 100% standard C.
[...]
The garbage collector is "language agnostic" and will work for C,
C++ or objective C in the same fashion.
Every time jacob brings this up, he neglects to mention that garbage
collection can, in some circumstances, break strictly conforming code
that would work in the absence of garbage collection. GC works only
if all pointers are visible to the garbage collector in memory or
registers. For most code, perhaps even the vast majority, this is not
an issue. But if a non-GC C program that uses malloc() and free()
either writes a pointer value to a file (and reads it back during the
same execution of the program) or breaks down a pointer value into
bits or bytes (think about in-memory compression or encryption), the
pointer is guaranteed to be valid once the pointer value put back
together. With garbage collection, the GC is likely to assume that,
since it can't see the pointer, the memory it points to can be
deallocated, making the pointer invalid.
It's probably easy enough to avoid this, but it's important not to
just ignore the issue.