On Friday, 16 May 2014 at 14:52:17 UTC, Marc Schütz wrote:
But that's extern(C++), not extern(C)...
That should be a different name mangling, so won't link. Winapi
functions are declared as extern C for C++ compiler.
I am working on a project to provide D binding files for the C/C++
FOSS BRL-CAD project:
http://brlcad.org
My work is on the d-binding branch and specifically here:
http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/branches/d-binding/misc/d-bindings/
My plan is to automatically
On 20/05/2014 10:36 p.m., Tom Browder via Digitalmars-d-learn wrote:
I am working on a project to provide D binding files for the C/C++
FOSS BRL-CAD project:
http://brlcad.org
My work is on the d-binding branch and specifically here:
Did I understand correct that a function can only be @nogc if
also all functions that it calls are @nogc too (and of course it
doesn't use the GC itself)?
If so, should this be possible:
string foo()
{
// use GC to allocate some string
}
bar @nogc
{
mixin(foo());
}
Because, bar()
On Tuesday, 20 May 2014 at 12:25:11 UTC, Dominikus Dittes Scherkl
wrote:
Did I understand correct that a function can only be @nogc if
also all functions that it calls are @nogc too (and of course
it doesn't use the GC itself)?
If so, should this be possible:
string foo()
{
// use GC to
In D code I do
void* data = GC.malloc(...);
if(data is null)
...
In C code I do
void* data = malloc(...);
if(data == null)
...
What to do when in D code I have
void* data = std.c.stdlib.malloc(...);
if(data ?) // is null vs == 0
Alexandr Druzhinin:
In D code I do
void* data = GC.malloc(...);
if(data is null)
...
In C code I do
void* data = malloc(...);
if(data == null)
...
What to do when in D code I have
void* data = std.c.stdlib.malloc(...);
if(data ?) // is null vs == 0
x is null or x == null are
On Tuesday, 20 May 2014 at 14:03:17 UTC, Alexandr Druzhinin wrote:
if(data ?) // is null vs == 0
Both would work and do the same thing, but I prefer is null
because that is most consistent with other D code (where there
might be a difference between the two).
Adam D. Ruppe:
but I prefer is null because that is most consistent with
other D code (where there might be a difference between the
two).
Curiously I do the opposite, I use == to remind me it's a pointer
:-)
Bye,
bearophile
On Tuesday, 20 May 2014 at 12:25:11 UTC, Dominikus Dittes Scherkl
wrote:
Did I understand correct that a function can only be @nogc if
also all functions that it calls are @nogc too (and of course
it doesn't use the GC itself)?
If so, should this be possible:
string foo()
{
// use GC to
Given a range with element type char, what's the best way of
iterating over it by code-point, without filling an array first?
Related to this: What's the status of std.utf and std.encoding?
The comments in std.encoding say that some functions supersede
their std.utf counterparts.
On Tue, 20 May 2014 17:59:07 +, John Colvin wrote:
Given a range with element type char, what's the best way of iterating
over it by code-point, without filling an array first?
Related to this: What's the status of std.utf and std.encoding? The
comments in std.encoding say that some
Is it a bug that an immutable struct cannot be sent to a thread? (It compiles
without problem if I make all elements mutable.)
On 05/20/2014 11:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
Is it a bug that an immutable struct cannot be sent to a thread? (It compiles
without problem if I make all elements mutable.)
Does the struct have any mutable indirection? Then it is illegal.
Otherwise, can you
On Tuesday, 20 May 2014 at 17:59:09 UTC, John Colvin wrote:
Given a range with element type char, what's the best way of
iterating over it by code-point, without filling an array first?
Related to this: What's the status of std.utf and std.encoding?
The comments in std.encoding say that some
On Tuesday, 20 May 2014 at 18:06:09 UTC, Justin Whear wrote:
Foreach on narrow strings automatically decodes, so it's as
simple as:
// assume UTF-8 encoded
char[] myData = ...
foreach (dchar codePoint; myData)
...
I think the point of his question is if you have an actual
non-array range
On Tuesday, 20 May 2014 at 17:14:31 UTC, John Colvin wrote:
On Tuesday, 20 May 2014 at 12:25:11 UTC, Dominikus Dittes
Scherkl wrote:
Did I understand correct that a function can only be @nogc if
also all functions that it calls are @nogc too (and of course
it doesn't use the GC itself)?
If
On Tuesday, 20 May 2014 at 20:15:09 UTC, Dominikus Dittes Scherkl
wrote:
/// create a fixed size array with the given name and with
*max* entries
max + 1 entries
/// of immutable values of the same type as the return value of
the
/// given function.
/// it contains the values of that
On Tuesday, 20 May 2014 at 21:04:37 UTC, anonymous wrote:
On Tuesday, 20 May 2014 at 20:15:09 UTC, Dominikus Dittes
Scherkl
wrote:
/// create a fixed size array with the given name and with
*max* entries
max + 1 entries
/// of immutable values of the same type as the return value
of the
On Tuesday, 20 May 2014 at 21:16:26 UTC, monarch_dodra wrote:
enum ReturnType!fn[length] lookupTable = [elements];
Depending on what the usecase is, you might want to change that
to static immutable instead:
static immutable ReturnType!fn[length] lookupTable = [elements];
Remember that
On 05/20/2014 11:04 PM, anonymous wrote:
On Tuesday, 20 May 2014 at 20:15:09 UTC, Dominikus Dittes Scherkl
wrote:
/// create a fixed size array with the given name and with *max* entries
max + 1 entries
/// of immutable values of the same type as the return value of the
/// given function.
On 05/20/2014 11:48 PM, Timon Gehr wrote:
This achieves the same:
template lookupTable(alias fn,uint max=255){
static assert(maxuint.max);
enum ReturnType!fn[max+1] lookupTable=iota(0,max+1).map!fn.array;
}
(Though I'd never actually do template argument checking in a static
On Tuesday, 20 May 2014 at 21:48:08 UTC, Timon Gehr wrote:
Wtf. Is this really the point you are trying to make? :o)
This achieves the same:
template lookupTable(alias fn,uint max=255){
static assert(maxuint.max);
enum ReturnType!fn[max+1]
lookupTable=iota(0,max+1).map!fn.array;
}
On Tuesday, 20 May 2014 at 19:58:17 UTC, monarch_dodra wrote:
On Tuesday, 20 May 2014 at 17:59:09 UTC, John Colvin wrote:
Given a range with element type char, what's the best way of
iterating over it by code-point, without filling an array
first?
Related to this: What's the status of
On Tuesday, May 20, 2014 11:42:48 AM Ali Çehreli via Digitalmars-d-learn
wrote:
On 05/20/2014 11:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
Is it a bug that an immutable struct cannot be sent to a thread? (It
compiles without problem if I make all elements mutable.)
Does the
On Tuesday, May 20, 2014 11:42:48 AM Ali Çehreli via Digitalmars-d-learn
wrote:
On 05/20/2014 11:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
Is it a bug that an immutable struct cannot be sent to a thread? (It
compiles without problem if I make all elements mutable.)
Does the
26 matches
Mail list logo