learning c++

For people working on the C++ code.
Post Reply
User avatar
Neuromancer
Member
Posts: 964
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

learning c++

by Neuromancer » Post

So I'm learning c++. I wrote a couple small projects in it 20 plus years ago but reading the Minetest code has been difficult to say the least. Anyway, one of the interesting things I discovered in that the new C++ standard, there is a thing called smart pointers (shared pointers and unique pointers) and these things are in the standard library. They basically are classes that wrap pointers so that you don't have to worry about deleting them when they go out of scope. It removes a lot of the administrative code you have to do when cleaning long lived objects off of the heap/free storage. I'm guessing this is too new for Minetest to use but it seems really cool. Does anyone know if minetest uses C++11 and smart pointers?
Last edited by Neuromancer on Wed Feb 20, 2013 03:29, edited 1 time in total.

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Celeron55 should have took Python since day 1. Oh and yes, compared to C/++ it is nice, clean and frickin readable.

User avatar
0gb.us
Member
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000
Contact:

by 0gb.us » Post

Jordach wrote:Celeron55 should have took Python since day 1. Oh and yes, compared to C/++ it is nice, clean and frickin readable.
Python (as a language) has issues too though. I won't argue with you though, as I don't know C++, so I can't compare the two.

But isn't C++ lower level, and therefore faster running? Also, Python doesn't compile into a nice executable, but into byte code to be run in an interpreter, further slowing it down. Surly the speed boost offered by C++ is worth it?

rarkenin
Member
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Post

0gb.us wrote:
Jordach wrote:Celeron55 should have took Python since day 1. Oh and yes, compared to C/++ it is nice, clean and frickin readable.
Python (as a language) has issues too though. I won't argue with you though, as I don't know C++, so I can't compare the two.

But isn't C++ lower level, and therefore faster running? Also, Python doesn't compile into a nice executable, but into byte code to be run in an interpreter, further slowing it down. Surly the speed boost offered by C++ is worth it?
There used to be a mid-way point, via HipHop, but the HipHop->C++->Native has been discontinued.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.

User avatar
celeron55
Administrator
Posts: 533
Joined: Tue Apr 19, 2011 10:10
GitHub: celeron55
IRC: celeron55

by celeron55 » Post

Neuromancer wrote:I'm guessing this is too new for Minetest to use but it seems really cool. Does anyone know if minetest uses C++11 and smart pointers?
Minetest uses smart pointers for a small amount of things, but not those found in C++11. It has it's own implementation. Most of the time they aren't worth using though; memory management in constructors and destructors is easy. Also, Irrlicht uses reference counting for it's stuff.
Jordach wrote:Celeron55 should have took Python since day 1. Oh and yes, compared to C/++ it is nice, clean and frickin readable.Celeron55 should have took Python since day 1. Oh and yes, compared to C/++ it is nice, clean and frickin readable.
Python is a nice language, but sucks way more than Lua for embedding. Also, it should be obvious that Python or Lua or anything like that is way too slow for the core things in Minetest. You simply can't do things like mesh or map generation or voxel lighting in realtime in it.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests