News for hackers. Stuff that matters.
Re:Special Cases Are a Code Smell by taco_emoji on Friday January 25, 2019 @01:44PM (#19000999)
Padding with zeroes doesn't have to involve reallocating anything--you could wrap the array in an iterator that first yields 0, then yields each array element, then yields 0 again.

E.g. in C# using Linq:

    foreach (var num in myArray.Prepend(0).Append(0)) { /* blah */ }

There are no comments on this comment yet.