Variable-length stack allocated arrays

Chad J chadjoan at __spam.is.bad__gmail.com
Mon Jan 11 19:44:15 PST 2010


dsimcha wrote:
> 
> The optional buffer idiom is great for stuff that's returned from a function.  I
> use it all the time.  On the other hand, for temporary buffers that are used
> internally, whose mere existence is an implementation detail, having the caller
> maintain and pass in a buffer is a horrible violation of encapsulation and good
> API design, even by the standards of performance-oriented APIs.  Even if you know
> it's never going to change, it's still annoying for the caller to even have to
> think about these kinds of details.
> 

Yes, quite.



More information about the Digitalmars-d mailing list