primitive vector types

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Feb 21 10:14:19 PST 2009


On Sat, Feb 21, 2009 at 12:32 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:

> Yah. Walter agrees that that's the right thing to do. The only thing that
> worries us is passing by-value large statically-sized vectors to template
> functions. But then gaming code wants to do exactly that. It's hard to
> figure where to draw the line. Imagine the error message "Hey, you're going
> a bit overboard by passing 512 bytes around on the stack".

Structs already work like this.  In fact, the compiler will pass a
struct in a register if it's 1, 2, or 4 bytes on x86.  Having the
compiler "magically" put float[4]s in SSE registers seems like a
similar idea.

> Besides, we already do have a solution for pass-by-value vectors:
> Tuple!(T[N]). That would put the burden in the right place (on the
> programmer actively wanting pass-by-value). But then it's a shame that the
> built-in type T[N] is a weird exception that must be handled in all template
> code.

Please make them value types.  I, for one, am tired of dealing with their crap.



More information about the Digitalmars-d mailing list