Linked by Thom Holwerda on Fri 15th Feb 2013 10:40 UTC
Permalink for comment 552627
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
Features
Linked by Thom Holwerda on 05/21/13 21:38 UTC
Linked by Thom Holwerda on 05/20/13 11:29 UTC
Linked by Thom Holwerda on 05/18/13 21:33 UTC
Linked by David Adams on 05/16/13 4:23 UTC
Linked by Thom Holwerda on 05/11/13 21:41 UTC
Linked by Thom Holwerda on 05/08/13 14:22 UTC
Linked by Thom Holwerda on 05/02/13 15:28 UTC
Linked by Thom Holwerda on 04/29/13 21:06 UTC
Linked by Thom Holwerda on 04/24/13 22:24 UTC
Linked by Thom Holwerda on 04/18/13 11:21 UTC
More Features »
Sponsored Links



Member since:
2011-01-28
Bill Shooter of Bul,
"Eh,I've always preferred using arrays rather than numerically named vars. It usually is easier that way."
I don't prefer arrays, but I guess I can see why you would.
My concern would that in many languages the arrays will have an additional performance cost though, requiring more indirection and more calls to alloc/free, and maybe more bounds checking as well. Even with C, the array might conceivably force the compiler to use a specific memory structure when the variable solution might have allowed more register optimizations. Its very hard to predict compiler's optimization behavior these days though.
Edit: How would you formulate a draw line function using arrays?
drawline(single x1, single y1, single x2, single y2);
drawline(single x[2], single y[2]);
// Above is too weird for me, structures would be a bit better.
drawline(coord p1, coord p2)
drawline(coord p[2]);
Edited 2013-02-15 15:11 UTC