Skip to content

u/patchhill

In this archive from Dec 2013 to Mar 2014

3
posts
56
comments
0
media
283
score

Top posts

Big release for some lua bindings I wrote

I little while back, I posted a thread asking how people integrated Lua into their games. The big thing I was missing at the time was the ability to register C++ classes along with their member functions, variables, constructor, and destructor. This is done now for a game I am working on and I figur...

25 points32 comments
Open on Reddit

My take on C++ bindings to SDL

https://github.com/jeremyong/SDLpp I'm working independently on a game as was dissatisfied with SFML (although I loved some abstractions such as views and such) so I ported my game to SDL. What I didn't like about SDL was needing to free or deallocate everything myself which is error prone. I also d...

17 points23 comments
Open on Reddit

Top comments

This cannot be understated. Effective C++ is considered a must read by virtually all C++ professionals. There are some things that have changed a bit since the advent of C++, namely, the usage of unique_ptr in lieu of auto_ptr and shared_ptr (where possible), the introduction of lambdas, noexcept practices, move constructors, the rule of 3 becoming the rule of 4 (swap being the fourth), and more template programming techniques.

There are probably a number of things I'm forgetting, but yea, Effective C++ is really excellent. I still pick it up as bedtime reading from time to time to keep myself honest.

32 points

No. Usage of tr1's shared_ptr may have been avoided mainly because there wasn't a need for a reference counted pointer.

Too much deletion happening.

The type of the pointer has absolutely nothing to do with the frequency of deletion. Please clarify this.

Memory management and exceptions are basically unused knowledge

You don't need to use exceptions to write exception safe code. And this is bad advice too. If a programmer doesn't know about move constructors, I don't want that programmer touching my codebase (until it's learned).

Also, unique_ptr allows you to provide a custom deleter, which is a semantically better (and typesafe) way to provide "custom pointer" functionality.

16 points

The reason I opted not to use luabind is that luabind is a huge project with an undesirable boost dependency. IMHO, luabind is also a lot harder to use for more simple things and the most common tasks. The philosophy I had was to handle the majority of cases with the cleanest syntax possible. You're encouraged to look at the README for examples.

Also, my library has no dependencies outside of lua. My reasoning is that, lua was meant to be small and compact. Tacking on lots of cruft seemed to belie the underlying philosophy.

9 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.