Tag: c++
Working with mruby
August 17, 2019 22:55
Having worked with Lua before and made a LuaCppInterface, I decided about a year ago to start working on a C++ interface for mounting mruby as a scripting language.
To start, I have been developing in Ruby for several years now and I found it to be q...
Read postExceptionless Programming
November 28, 2012 00:00
I am a big fan of writing code that generates no runtime errors. This is an implementation of a function that takes the first element of an array.
template<typename T>
T first(std::vector<T> array)
{
if (array.size() == 0) { throw EmptyArrayException(); }
return array[0];
}
This is ...
Read postWhy I Prefer Initialization Through Constructors
September 18, 2011 00:00
I always prefer initializing my class through the use of a constructor like this:
class Apple
{
Color color;
Taste taste;
List<string> countries;
public Apple(Color color, Taste taste, List<string> countries)
{
this.color = color;
this.taste = taste;
this.countries = countries...
Read postWill the destructor be called?
August 10, 2010 00:00
Here's a C++ quiz for all of you: somefunc() will be called from a thread. Do you think this destructor will be called?
class A {
public:
A () {
printf("Constructor\t");
}
~A() {
printf("Destructor\n");
}
};
int somefunc () {
A inst;
int* a = 0
*a = 1;
return 0;
}
...
Read post