On Thu, Jun 9, 2011 at 9:20 AM, tora - Takamichi Akiyama < t...@openoffice.org> wrote:
> That is why I would like to encourage programmers to take care of the life > time of data. > First of, I am doubtful that encouraging manual memory management is a good idea. Errors in manual memory management probably are the cause for the vast majority of severe failures in C/C++ programs. Hence, I would always try to abstract from actual memory as much as possible. (Performance considerations are of course valid, but they must be balanced against safety and maintainability considerations.) What you describe with "Slicing cheese and throwing them out at once" can be done, but I would not want to do it manually. There are systems more clever than C++, building on effect types and region-based memory management, that exploit such optimizations. But there, it is the language implementation---and not the programmer writing a program in that language---that carries out the proof that keeping data in a region of memory that is discarded wholesale at a certain point in time is sound. That said, it might work to map your various levels of data---from "data lasting until the soffice.bin quits" to "data lasting until a current function call returns"---to different C++ types with appropriate conversion functions that potentially need to copy data, to statically ensure sound memory access while on the one hand allowing to exploit optimized memory management strategies and on the other hand still being safe if data does escape from its anticipated level. Would be a nice experiment. -Stephan -- ----------------------------------------------------------------- To unsubscribe send email to dev-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help