> Technically, you can: it _is_ an array as far as C is concerned. I > don't see anything, then, you can do with a statically sized array you > can't do here. If you're using something like lclint, purify, or electric fence to check for overrunning your bounds, it won't be reliably picked up when you use an offset from a given memory location; it will if you're using the array subscriping. As a matter of fact, you can pretty easily overrun your bounds and have a valid return type with that system - whereas you'll have a heathy crash a decent amount of the time otherwise (which indicates what's wrong, and then you go fix it). This may be a missed point - but it's multidimensional arrays that we're worried about. Since those can be dynamically created and then treated exactly like a static version of themselves this seems to be both a simple and susccinct solution. > ultimately more flexible, and, I believe, not subject to any significant > increase in code complexity or effort. I agree that it is just as easy to use one as the other (thought I put that in my last post). That is, not any more flexible either way. The syntax is nearly identical. The issue is those newbies though. You and I grasp the whole concept behind pointer math, and difficult memory allocation concepts. But if I were unexperienced, i'd want to rely on that familiar array[][] type subscripting. As a matter of fact, if I was very unexperienced, I'd end up copying code from any source that does use pointer math to iterate through arrays, and suddenly i'd be in trouble, because we'd be crashing or writing random fragments out and I'd have no clue why. Especially with newbies it's best to adhere to KISS. If anything, rather than use macros to impose a structure on a memory blob though an abstraction, I think someone could more quickly understand simply dynamically allocating arrays of arrays. It's just a small for loop to assign them, and then you use them as if they were statically declared. Of course, both deal with separate issues with memory contingency when making alterations to the sizes of any of the dimensions. You'll always have to end up moving stuff around by hand. PjD +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT