Re: equivalent of __attribute__((constructor))

2013-05-24 Thread Jacob Carlborg
On 2013-05-24 02:02, Ellery Newcomer wrote: posix.mak makes no reference to it Then I guess it's not used. Just compile it manually and link with it. I don't think that D has anything corresponding to __attribute__((constructor)). I also see a problem with adding such feature. It will be

Convert 1080/60p AVCHD Videos to Mac FCP Compatible 1080/60p ProRes

2013-05-24 Thread daisy520
Convert 1080/60p AVCHD Videos to Mac FCP Compatible 1080/60p ProRes AVCHD to 1080/60p ProRes 422 (HQ) Converter - Panasonic HS700 to FCP Do you face any problem when trying to import the 1080/60p or 180/50p AVCHD videos from Panasonic HDC-HS700 to Final Cut Studio? In the Panasonic HS700 camera

Passing large or complex data structures to threads

2013-05-24 Thread Joseph Rushton Wakeling
Hello all, Are there any recommended strategies for passing large or complex data structures (particularly reference types) to threads? For the purpose of this discussion we can assume that it's read-only data, so if we're talking about just an array (albeit perhaps a large one) I guess just

Re: What xml libraries are people using?

2013-05-24 Thread Gary Willoughby
On Saturday, 2 March 2013 at 18:42:13 UTC, Andrej Mitrovic wrote: On 3/2/13, simendsjo simend...@gmail.com wrote: Which can you recommend? I use ae's lite xml library: https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d It's not a monster but thanks to UFCS I can easily extend it

Re: Passing large or complex data structures to threads

2013-05-24 Thread Simen Kjaeraas
On 2013-05-24, 15:26, Joseph Rushton Wakeling wrote: Hello all, Are there any recommended strategies for passing large or complex data structures (particularly reference types) to threads? For the purpose of this discussion we can assume that it's read-only data, so if we're talking about

class MyClass(T) : Base if (ConstraintExpression) {} compilation error

2013-05-24 Thread ref2401
Version D 2.062 Please explain what is causing the error class Base { } class Class(T) : Base if (is(T == int)) { } Error: unrecognized declaration Error: members expected Error: Declaration expected, not 'if' Error: { } expected following aggregate declaration

Re: class MyClass(T) : Base if (ConstraintExpression) {} compilation error

2013-05-24 Thread Simen Kjaeraas
On 2013-05-24, 16:49, ref2401 wrote: Version D 2.062 Please explain what is causing the error class Base { } class Class(T) : Base if (is(T == int)) { } Error: unrecognized declaration Error: members expected Error: Declaration expected, not 'if' Error: { } expected following aggregate

Re: class MyClass(T) : Base if (ConstraintExpression) {} compilation error

2013-05-24 Thread Maxim Fomin
On Friday, 24 May 2013 at 14:49:24 UTC, ref2401 wrote: Version D 2.062 Please explain what is causing the error class Base { } class Class(T) : Base if (is(T == int)) { } Error: unrecognized declaration Error: members expected Error: Declaration expected, not 'if' Error: { } expected

Re: Passing large or complex data structures to threads

2013-05-24 Thread Ali Çehreli
On 05/24/2013 06:26 AM, Joseph Rushton Wakeling wrote: Are there any recommended strategies for passing large or complex data structures (particularly reference types) to threads? std.concurrency works with shared data. For the purpose of this discussion we can assume that it's read-only

Re: What xml libraries are people using?

2013-05-24 Thread Benjamin Thaut
Am 02.03.2013 09:03, schrieb simendsjo: Everyone says Don't use std.xml, and there are several other libraries. Which can you recommend? (I haven't looked closely at any of them, just some links found by googling)

Re: equivalent of __attribute__((constructor))

2013-05-24 Thread Johannes Pfau
Am Wed, 22 May 2013 21:27:00 -0700 schrieb Ellery Newcomer ellery-newco...@utulsa.edu: In the context of shared libraries, with gcc __attribute__((constructor)) void myfunc() { .. } is used to make myfunc be called upon loading of the shared library (you can tell I know what I am talking

Re: Dispatching values to handlers, as in std.concurrency

2013-05-24 Thread Luís.Marques
On Tuesday, 7 May 2013 at 06:19:24 UTC, Idan Arye wrote: If it's not templated - make it templated! You don't have to make the entire `TypeHanler` templated, just the method that creates it. There, you can create an anonymous function that receives `Object` and returns `bool` and all it does

Problem with object understanding and datatypes

2013-05-24 Thread Namal
So the task is to write a struct object for the saturation arithmetic. I tried first to write it for the unsigned Types: struct Saturated(T) if (isIntegral!T) { static assert (isUnsigned!T || isSigned!T); @property { static Saturated min() {

Re: Problem with object understanding and datatypes

2013-05-24 Thread Ali Çehreli
On 05/24/2013 01:19 PM, Namal wrote: if(rhs.max - rhs._value _value) I had a compilation error so I had to change that line to the following: if(T.max - rhs._value _value){ assert(subyte(128) - subyte(129) == subyte(0)); } But the last test does not pass.

deducing function/delegate in template method

2013-05-24 Thread Luís.Marques
In this code: // accepts a list of handlers, for the respective types void addHandlers(T...)(T handlers) { foreach(handler; handlers) { addHandler(handler); } } // accepts one handler, for type T void addHandler(T)(void delegate (T)

Re: deducing function/delegate in template method

2013-05-24 Thread Luís.Marques
On Friday, 24 May 2013 at 22:37:49 UTC, Luís Marques wrote: foo.addHandlers(delegate (int x) { /* if no scope access deduction fails */ }); (I meant that deduction would fail if the literal was not marked as a delegate)

Re: equivalent of __attribute__((constructor))

2013-05-24 Thread Ellery Newcomer
On 05/23/2013 11:39 PM, Jacob Carlborg wrote: On 2013-05-24 02:02, Ellery Newcomer wrote: posix.mak makes no reference to it Then I guess it's not used. Just compile it manually and link with it. I don't think that D has anything corresponding to __attribute__((constructor)). I also see a

How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Heinz
Hi, I'm porting a C++ header (i'm not a C++ programmer) and came with the following declaration: #define my_id 'asdf' How does this translate to D? Thanks

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Luís.Marques
On Saturday, 25 May 2013 at 00:02:50 UTC, Heinz wrote: #define my_id 'asdf' string my_id = asdf;

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Luís.Marques
On Saturday, 25 May 2013 at 00:07:02 UTC, Luís Marques wrote: On Saturday, 25 May 2013 at 00:02:50 UTC, Heinz wrote: #define my_id 'asdf' Ah, sorry, didn't notice the single quotes.

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Luís.Marques
I remember that there was a smarter way to do this, but you can do it manually. Something like: immutable long my_id = 'a' 24 + 'b' 16 + 'c' 8 + 'd'; Or you can create a CTFE function to do this from a string, which should be nicer, if you don't find an existing utility for this.

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Ali Çehreli
On 05/24/2013 05:02 PM, Heinz wrote: Hi, I'm porting a C++ header (i'm not a C++ programmer) and came with the following declaration: #define my_id 'asdf' How does this translate to D? Thanks If it really has single quotes then it is a multi-character literal, value of which happens to be

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Heinz
If it really has single quotes then it is a multi-character literal, value of which happens to be implementation-dependent. What is actually in place of asdf there? May be we can guess the intent better. Ali Here're some examples: #define kPIHostBlendModeSignature '8BIM' #define

Re: Problem with object understanding and datatypes

2013-05-24 Thread Namal
255 - 129 is less than 128 so the result is T.max, which is 255, which is not equal to 0. I dont understand this at all 255 - 129 should be 126 in ubyte or not?

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Ali Çehreli
On 05/24/2013 05:49 PM, Heinz wrote: If it really has single quotes then it is a multi-character literal, value of which happens to be implementation-dependent. What is actually in place of asdf there? May be we can guess the intent better. Ali Here're some examples: #define

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread bearophile
Ali Çehreli: If the multi-character literals are evaluated big-endian as Luís Marques and I guess, then you can use the following code: Also, D defines version(BigEndian) and version(LittleEndian). Bye, bearophile

Re: Problem with object understanding and datatypes

2013-05-24 Thread Juan Manuel Cabo
On Saturday, 25 May 2013 at 01:03:53 UTC, Namal wrote: 255 - 129 is less than 128 so the result is T.max, which is 255, which is not equal to 0. I dont understand this at all 255 - 129 should be 126 in ubyte or not? I checked, and operation between two ubyte is an int. When you cast

Re: How to translate this C++ preprocessor declaration in D?

2013-05-24 Thread Heinz
Guys, i also did a templated version that yields the same output as the C++ program: import std.stdio; template makeId(char[4] id) { const makeId = id[0] 24 | id[1] 16 | id[2] 8 | id[3]; } const