Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
This is along the lines of heap allocation...sorry, but I have no code to illustrate...
I have a function that needs a variable sized buffer, but that [red]exact[/red] size isn't known until we already are calculating using the buffer, and we run out of space. However, what I can pre-calculate is the [red]maximum[/red] size the buffer could be given some other variables, the least size that the worse case scenario can use and still work.
Well, the buffer is returned (sorta, rather the buffer in the first place wasn't the function's, but it is the buffer the result is stored in; it may be sized to fit the whole answer). So afterwards, I need to remove the excess space, and that means I wasted space...
However, if I go the other way, the algorithm would be slow...my logic is to go with the former...but me, hardly a novice, I wonder if my logic holds for you guys.
thats all, thanx all of you(or just Lundin or Niklas,it'll probably be you two to reply)
0 · ·