On Wednesday 11 of April 2012 11:43:36 Richard Guenther wrote:

> > () The overloadable operator new means that memory can be
> > _implicitly_ allocated in the right place.
> 
> Implicit allocation is bad.  In a compiler you want to _see_ where you
> spend memory.

in c++ you can overload new/delete operators for each class and track
all these allocations with provided allocator. please consider following
example: http://pastebin.com/UmBGWMTH
you can bind polls, gc or anything else you want for any class
and just use the new/delete keywords in sources as usual.
in pure C you need to call the right malloc_*/free_* variants for each class.

> > () Class hierarchies also mean that programmers can distinguish
> > in the pointer types that a function needs a decl parameter,
> > without having to say 'all trees' versus 'a very specific tree'.
> > The static type checking avoids run-time bugs.
> 
> True.  In a very limited set of cases.  C++ is not powerful enough
> to express pointer-to-everything-that-would-be-considered-a-gimple-val.
> Maybe C++ is not the right choice after all?  (I suppose C++ concepts
> would have helped here? pointer-to-tree-that-fulfils-is_gimple_val ...
> (though is_gimple_val is not be a static property).

hmm :)
the c# provides a nice constraints engine (google the 'where' keyword)
and the so-called duck-typing (c# 4.0) which might simplfy the source
code that operates on ast nodes.

Reply via email to