Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 09 Dec 1999
Offline Last Active Yesterday, 11:59 PM

Posts I've Made

In Topic: How does std::vector<std::list> behave when I add a new item to any o...

20 December 2014 - 05:41 PM

No, the memory for the entire vector will not reallocate if you add something to one of the individual lists.

In Topic: "defer": is this silly / broken?

09 December 2014 - 10:58 AM

The first problem that comes to mind is that you're executing arbitrary code inside a destructor. If that code throws an exception during stack unwind then your program could turn into a big puddle of goo. 

In Topic: Datatype Size and Struct Compiler Padding

04 November 2014 - 12:55 AM

3. The size of any non-fixed size type can change between platforms. All you are really guaranteed is that size(char) = 1, sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long). Use the fixed size types if you need a guaranteed range.

Well you're also guaranteed that char is at least 8 bits, short and int are at least 16 bits, long is at least 32 bits and long long is at least 64 bits.

In Topic: [Fixed]Image parsing : Read all file or x bytes at a time ?

27 October 2014 - 10:09 AM

infile.read(bufferRestOfFile, sizeof(bufferRestOfFile));
I don't think this line does what you think it does. sizeof gives the static size of the pointer, not the dynamic size of what it points to.

In Topic: Writing python strings for C++

21 September 2014 - 03:23 PM

You need to convert the string to a bytes object before you serialize it. However, once it's converted to a bytes object you don't need to bother sending it through struct, just write it to the file.