Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 06, 2013 Very short article with with manual memory management in C++ and D. | ||||
---|---|---|---|---|
| ||||
Hi, long time ago I wrote a short article about doing manual memory management from C++. http://www.progtools.org/compilers/tutorials/queue/article.html This was based on a job offer I saw in a games magazine. Eventually I ported the solution to D, while keeping the code as close as possible to the original C++ version. http://www.progtools.org/compilers/tutorials/queue/queue.cpp.html http://www.progtools.org/compilers/tutorials/queue/queue.d.html Since these type of small exercises are the only area where I might use D occasionally, are there any issues on the D version that could be improved, while keeping the code as close as possible to the C++ version? Thanks, Paulo |
February 06, 2013 Re: Very short article with with manual memory management in C++ and D. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | On Wednesday, 6 February 2013 at 09:36:32 UTC, Paulo Pinto wrote:
> Eventually I ported the solution to D, while keeping the code as close as possible to the original C++ version.
Paulo, can you tell why you chose to keep the D code much as the
same the C++ version?
|
February 06, 2013 Re: Very short article with with manual memory management in C++ and D. | ||||
---|---|---|---|---|
| ||||
Posted in reply to MattCoder | On Wednesday, 6 February 2013 at 10:13:49 UTC, MattCoder wrote:
> On Wednesday, 6 February 2013 at 09:36:32 UTC, Paulo Pinto wrote:
>> Eventually I ported the solution to D, while keeping the code as close as possible to the original C++ version.
>
> Paulo, can you tell why you chose to keep the D code much as the
> same the C++ version?
Languages with stronger type checking, and GC capabilities are usually looked down by some hardcore C++ developers.
I just wanted to show that the pointer tricks for memory management are not an exclusivity from C and C++.
Maybe I should present two versions, the current one which mimics the C++ version and an improved version.
--
Paulo
|
February 06, 2013 Re: Very short article with with manual memory management in C++ and D. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | On Wednesday, 6 February 2013 at 13:16:45 UTC, Paulo Pinto wrote:
> I just wanted to show that the pointer tricks for memory management are not an exclusivity from C and C++.
I get it! Just one more note, would you have done any benchmark test on between both versions?
|
February 07, 2013 Re: Very short article with with manual memory management in C++ and D. | ||||
---|---|---|---|---|
| ||||
Posted in reply to MattCoder | On Wednesday, 6 February 2013 at 21:35:12 UTC, MattCoder wrote:
> On Wednesday, 6 February 2013 at 13:16:45 UTC, Paulo Pinto wrote:
>> I just wanted to show that the pointer tricks for memory management are not an exclusivity from C and C++.
>
> I get it! Just one more note, would you have done any benchmark test on between both versions?
Not really, it is very simple code to be worth doing any benchmarks.
|
Copyright © 1999-2021 by the D Language Foundation