C Memory

2013-05-05 Thread Namespace
Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data. Since I cannot free this memory with the DTor: what will happen? AFAIK this cannot be freed by the GC because it was not allocated by it. So AFAIK this creates a memory

Re: C Memory

2013-05-05 Thread Diggory
On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data. Since I cannot free this memory with the DTor: what will happen? AFAIK this cannot be freed by the GC because it

Re: C Memory

2013-05-05 Thread Namespace
On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data. Since I cannot free this memory with the DTor: what will

Re: C Memory

2013-05-05 Thread Diggory
On Sunday, 5 May 2013 at 07:23:25 UTC, Namespace wrote: On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data.

Re: C Memory

2013-05-05 Thread Johannes Pfau
Am Sun, 05 May 2013 09:28:05 +0200 schrieb Diggory digg...@googlemail.com: On Sunday, 5 May 2013 at 07:23:25 UTC, Namespace wrote: On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my

Re: C Memory

2013-05-05 Thread Namespace
Here a test example: http://dpaste.1azy.net/2cfc8ead The memory is allocated through the SDL as you can see.

Re: Check if tuple contains value at compile time

2013-05-05 Thread bearophile
Diggory: Is the behaviour of the empty [] when applied to tuples documented anywhere? I don't remember. The problem is that this doesn't work if the tuple is empty: Error: template std.algorithm.canFind does not match any function template declaration. And unfortunately in the situation

About std.string.representation

2013-05-05 Thread bearophile
Is it possible to have a transparent (by reference) std.string.representation? It's handy to modify the chars, like with permutations: import std.stdio: writeln; import std.range: nextPermutation; import std.string: representation; void main() { char[] perm = abcd.dup; do {

Regarding partition_copy

2013-05-05 Thread bearophile
Splitting a range in two according to a predicate is a common enough need. How do you translate this C++/STL idiom to D/Phobos? vectorint source_data; ... vectorint good_stuff, bad_stuff; partition_copy(begin(source_data), end(source_data), inserter(good_stuff, end(good_stuff)),

Re: D is totally useless

2013-05-05 Thread Raphaël Jakse
Le 02/05/2013 04:07, Carlos a écrit : On Wednesday, 1 May 2013 at 08:53:18 UTC, Raphaël Jakse wrote: Le 01/05/2013 10:42, Temtaime a écrit : I'm new in D, so i'm tried to write some in that langugage. That's story about how i tried to port OGL sample, that renders one triangle. You can do

Re: D is totally useless

2013-05-05 Thread David
Am 01.05.2013 21:36, schrieb Dejan Lekic: Temtaime wrote: I had investigate a little more in it. Thanks to Jack Applegame, we made a copy of gl/gl.h and opengl32.lib for DMD. http://acomirei.ru/u/gl.d http://acomirei.ru/u/opengl32.lib I hope it will be included in DMD, now it's first

Re: Avoid initializing a struct field.

2013-05-05 Thread Marco Leise
Am Sat, 04 May 2013 21:00:17 +0200 schrieb jerro a...@a.com: I tried using float[42] instead of int[42] and found out that buffer actually isn't initialized to its default initializer if I use = void (the numbers were all 0 instead of NaN), but the performance cost is still there. Zero is

Re: Regarding partition_copy

2013-05-05 Thread Andrei Alexandrescu
On 5/5/13 7:22 AM, bearophile wrote: Splitting a range in two according to a predicate is a common enough need. How do you translate this C++/STL idiom to D/Phobos? vectorint source_data; ... vectorint good_stuff, bad_stuff; partition_copy(begin(source_data), end(source_data),