Question on layer/peeling

Michael Barker mikeb01 at gmail.com
Tue Jan 6 02:39:54 UTC 2015


>
> C# has a default (T) keyword to allow generic code to obtain the "zero"
> value for a type param.  Something like that for java would be nice.
>
When I first wrote the example, I was thinking that a simple no-op in the
value type case would be sufficient.  However, now that I think about it
something like a "zero" value might be necessary.  If the value type used
within the collection happened to have a reference as one of its components
then there is the ability to leak memory.  For this case, it wouldn't need
to be user-defined as long as "zero" meant that all references are null.

Mike.



More information about the valhalla-dev mailing list