Nobody understands templates?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 5 15:45:52 PST 2014


On Wed, Mar 05, 2014 at 11:31:12PM +0000, develop32 wrote:
> On Wednesday, 5 March 2014 at 22:46:40 UTC, sclytrack wrote:
> >Are there any disadvantages of using a fixed size array for fixed
> >size coordinates and vectors, over creating an actual typedef or
> >struct Vec3?
> 
> Don't know what's the current situation in druntime, but when I tried
> static arrays a while ago in my engine every second there were
> megabytes of garbage generated. I ended up using structs with fields.

Whoa. What did you do with those arrays?? Either you did something
wrong, or there's a nasty bug somewhere in the compiler/language; AFAIK
static arrays are supposed to be value types so they shouldn't generate
any garbage at all.


T

-- 
A computer doesn't mind if its programs are put to purposes that don't match their names. -- D. Knuth


More information about the Digitalmars-d-learn mailing list