Is it possible to have a structure with a dynamic size? The
structure would contain an array.
I know I can use templates, but the size won't be known at
compile time. I also know I could just put a dynamic array into
it, but that way it would just be a pointer.
I know there would be major is
On Tuesday, 15 April 2014 at 20:19:36 UTC, Dicebot wrote:
C has no knowledge of D ABI so this can't work. If you just
want to store D function pointer to later retrieve it and call
from D code, you can as well store it as void* (or extern(C)
with similar signature to preserve part of type) and
On Tuesday, 15 April 2014 at 20:15:42 UTC, Jeroen Bollen wrote:
exten(C) {
testFunction(int function(int));
}
testFunction now requires an external function as parameter. It
can't be called with a pointer to a D function.
Logical Solution:
extern(C) {
testFunction(extern(D
exten(C) {
testFunction(int function(int));
}
testFunction now requires an external function as parameter. It
can't be called with a pointer to a D function.
Logical Solution:
extern(C) {
testFunction(extern(D) int function(int)); // DOES NOT COMPILE
}
How do you fix this without mov
On Tuesday, 8 April 2014 at 14:26:46 UTC, Adam D. Ruppe wrote:
On Tuesday, 8 April 2014 at 14:23:02 UTC, Jeroen Bollen wrote:
Is there a documentation page about the 'uniform function call
syntax'?
http://dlang.org/function.html#pseudo-member
Oh beat me to it.
On Tuesday, 8 April 2014 at 14:23:02 UTC, Jeroen Bollen wrote:
Is there a documentation page about the 'uniform function call
syntax'?
Never mind, I think I understand all there is to it.
On Tuesday, 8 April 2014 at 14:13:10 UTC, Adam D. Ruppe wrote:
On Tuesday, 8 April 2014 at 14:04:01 UTC, Jeroen Bollen wrote:
Basically, why is this its own variable? Why doesn't D simply
use the variable it was called with?
A class reference is basically a pointer, passing it by
refe
This topic is somewhat related to this question I asked yesterday
on StackOverflow: http://stackoverflow.com/q/22921395/2558778
Basically, why is this its own variable? Why doesn't D simply use
the variable it was called with?
https://gist.github.com/Binero/10128826
I don't see why this need
On Friday, 4 April 2014 at 05:20:42 UTC, Mengu wrote:
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason,
I figured I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function po
On Thursday, 3 April 2014 at 18:13:31 UTC, Adam D. Ruppe wrote:
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
How do I pass a delegate to an external C function taking a
function pointer?
You can't do it directly in general, unless you can modify the
C function, the
On Thursday, 3 April 2014 at 18:05:26 UTC, Justin Whear wrote:
On Thu, 03 Apr 2014 17:59:30 +, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason,
I figured
I'd give it a shot here.
How do I pass a delegate to an external C function taking a
fun
After being downvoted on stackoverflow for no apperant reason, I
figured I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function pointer?
If you want some extra rep on StackOverflow you can also answer
here:
http://stackoverflow.com/questions/22845175/p
Just for reference, this is the compiling code:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
Still no luck:
import std.container;
import std.stdio;
void main()
{
DList!ubyte list1 = DList!ubyte();
list1 ~= cast(ubyte) 1;
list1 ~= cast(ubyte) 2;
list1 ~= cast(ubyte) 3;
foreach(ubyte item; list1[]) {
writeln(item);
}
}
/usr
Still not working:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
/usr/include/dlang/dmd/std/container.d(1925): Error: template
std.container.DList!ubyte.DList.insertBeforeNode cannot deduce
function from argument types !()(typeof(null), int), candidates
are:
/usr/include/dlang/dmd/std/co
On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it isn't
working. I
have tried the following code:
[...]
Maybe try using opSlice:
DList m
On Monday, 31 March 2014 at 19:26:23 UTC, Jeroen Bollen wrote:
On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it
isn't working. I
have tried the following
I am trying to foreach over a std.container.DList but it isn't
working. I have tried the following code:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
I am getting the following errors:
/usr/include/dlang/dmd/std/container.d(1925): Error: template
std.container.DList!ubyte.DList.insertB
On Monday, 3 March 2014 at 02:33:49 UTC, Adam D. Ruppe wrote:
On Sunday, 2 March 2014 at 23:21:49 UTC, Jeroen Bollen wrote:
Is there maybe a way to disable the garbage collector from
running unless you explicitly call it?
That's really the default. The GC in D runs if and only if you
do
On Sunday, 2 March 2014 at 23:17:12 UTC, bearophile wrote:
Jeroen Bollen:
I've read about ways to disable the garbage collector, but
that'd
mean it was initially enabled.
You can disable and then enable the garbage collector like this:
void main() {
import core.memory;
How to disable D's Garbage Collector? I have read stuff about
editing Phobos and simply take it out, and replace it with your
own to have stuff like the new keyword still work. Surely there
must be an easier way, where you can still allocate like you
normally would, as long as you deallocate too.
On Monday, 10 February 2014 at 00:44:23 UTC, Jesse Phillips wrote:
On Sunday, 9 February 2014 at 21:02:59 UTC, Jeroen Bollen wrote:
I'm building a webserver using the Vibe.d library. Whenever
the user requests a page inside my /images/ folder; I want
them to output this file.
Because
On Sunday, 9 February 2014 at 21:02:59 UTC, Jeroen Bollen wrote:
I'm building a webserver using the Vibe.d library. Whenever the
user requests a page inside my /images/ folder; I want them to
output this file.
Because there will be a lot of images present, and because
these are like
I'm building a webserver using the Vibe.d library. Whenever the
user requests a page inside my /images/ folder; I want them to
output this file.
Because there will be a lot of images present, and because these
are likely to change in the future, I would like to just get the
URL from the reque
On Tuesday, 21 January 2014 at 17:51:44 UTC, monarch_dodra
Is that your actual code? "MersenneTwisterEngine(seed)" is not
valid code, you have to provide the template arguments.
I meant to answer to this by the way, sorry. (in
need of edit feature :P )
On Tuesday, 21 January 2014 at 17:51:44 UTC, monarch_dodra wrote:
On Tuesday, 21 January 2014 at 17:13:39 UTC, Jeroen Bollen
wrote:
On Friday, 17 January 2014 at 19:00:29 UTC, Jeroen Bollen
wrote:
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen
wrote:
How do you correctly create a
On Friday, 17 January 2014 at 19:00:29 UTC, Jeroen Bollen wrote:
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen
wrote:
How do you correctly create a MersenneTwisterEngine with a
ulong as seed?
This question still isn't answered by the way.
Come on, surely someone knows h
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen
wrote:
How do you correctly create a MersenneTwisterEngine with a
ulong as seed?
This question still isn't answered by the way.
On Wednesday, 15 January 2014 at 21:23:03 UTC, Frustrated wrote:
Anyways, now that you have your RND2D you don't ever have to
pre-generate your noise. Obviously it is more computationally
expensive though.
Thing is, the image is finite so I figured it'd be best to
pre-generate a set of seeds,
How do you correctly create a MersenneTwisterEngine with a ulong
as seed?
On Sunday, 5 January 2014 at 01:23:58 UTC, Adam D. Ruppe wrote:
On Sunday, 5 January 2014 at 01:10:29 UTC, Jeroen Bollen wrote:
Is there a way to tell it to not initialize it?
I'm not sure of any except using the primitives. You can malloc
GC memory from GC.malloc (works the same way
Also about the previous C style malloc, to free it, I just use
the c style delete?
On Sunday, 5 January 2014 at 00:28:00 UTC, Adam D. Ruppe wrote:
On Sunday, 5 January 2014 at 00:17:12 UTC, Jeroen Bollen wrote:
Also a somewhat unrelated question, variables in D get
initialized by default, do they also when you define them
right after? Something like:
Maybe. Logically, it
Also a somewhat unrelated question, variables in D get
initialized by default, do they also when you define them right
after? Something like:
int[] iryy = new int[](50); // Will the array elements be
initialized to 0?
foreach(int i; irry) {
i = 20;
}
On Saturday, 4 January 2014 at 21:48:02 UTC, bearophile wrote:
Jeroen Bollen:
Divisions for every result would be expensive, and shifting
the output wouldn't return a uniform distribution.
If the ulong is uniform, then every of its ubytes is uniform.
So "& ubyte.max"
On Saturday, 4 January 2014 at 20:16:31 UTC, Jeroen Bollen wrote:
Also where is UIntType defined?
Alright, turns out it was just a template.
One more question though, I have my Engine set to have 'ulong' as
a seed through the template, which means that it'll also return
Also where is UIntType defined?
On Saturday, 4 January 2014 at 17:24:24 UTC, Adam D. Ruppe wrote:
And GC.addRange is in core.memory if you want that.
http://dlang.org/phobos/core_memory.html#addRange
Would that work with structs too?
Struct* i = malloc(Struct.sizeof);
i = &Struct(params);
On Saturday, 4 January 2014 at 17:22:44 UTC, Adam D. Ruppe wrote:
On Saturday, 4 January 2014 at 17:19:30 UTC, Jeroen Bollen
wrote:
Do I get malloc from the C library or does D also have a
function for this?
import core.stdc.stdlib; // malloc and free are in here
it uses it from the C
On Saturday, 4 January 2014 at 17:16:53 UTC, Adam D. Ruppe wrote:
On Saturday, 4 January 2014 at 17:15:12 UTC, Jeroen Bollen
wrote:
Is there a way to prevent the Garbage collector from running
on one particular object? Something like:
I would just malloc it.
int* CreatePermanentInt
Is there a way to prevent the Garbage collector from running on
one particular object? Something like:
int* CreatePermanentInt() {
int i = 5;
return &i;
}
And i wouldn't be collected after this.
On Friday, 3 January 2014 at 20:48:29 UTC, Jeroen Bollen wrote:
On Friday, 3 January 2014 at 20:37:06 UTC, Mineko wrote:
On Friday, 3 January 2014 at 20:34:17 UTC, Jeroen Bollen wrote:
On Friday, 3 January 2014 at 20:31:09 UTC, Mineko wrote:
So, I was doing some stuff with shared libraries and
On Friday, 3 January 2014 at 20:37:06 UTC, Mineko wrote:
On Friday, 3 January 2014 at 20:34:17 UTC, Jeroen Bollen wrote:
On Friday, 3 January 2014 at 20:31:09 UTC, Mineko wrote:
So, I was doing some stuff with shared libraries and need
some confirmation on what's going on with
On Friday, 3 January 2014 at 20:31:09 UTC, Mineko wrote:
So, I was doing some stuff with shared libraries and need some
confirmation on what's going on with
http://dlang.org/dll-linux.html
Is that page recent, or really old?
It's using printf and stuff so uhh.. Seems old.
Could anyone here p
On Friday, 3 January 2014 at 18:23:23 UTC, monarch_dodra wrote:
On Friday, 3 January 2014 at 17:41:48 UTC, Jeroen Bollen wrote:
On Friday, 3 January 2014 at 13:42:19 UTC, monarch_dodra wrote:
On Friday, 3 January 2014 at 13:30:09 UTC, Jeroen Bollen
wrote:
I already considered this, but the
On Friday, 3 January 2014 at 13:42:19 UTC, monarch_dodra wrote:
On Friday, 3 January 2014 at 13:30:09 UTC, Jeroen Bollen wrote:
I already considered this, but the problem is, I need to
smoothen the noise, and to do that I need all surrounding
'checkpoints' too. This means that it&
On Friday, 3 January 2014 at 10:06:27 UTC, monarch_dodra wrote:
On Friday, 3 January 2014 at 01:43:09 UTC, Chris Cain wrote:
So, it sounds like the OP is using the x and y coords for a
seed to generate a single number and he was curious to whether
it costs too much to reseed like this for every
D provides a set of Random Number Generators in std.random. I am
writing an application which would create a 2D map of noise. To
do this though, I'll have to calculate the same random numbers
over and over again. (I cannot store them, that'd take a horrible
amount of RAM. )
Is it good to re-s
On Monday, 16 December 2013 at 10:54:15 UTC, Hugo Florentino
wrote:
Hi,
I am writing a launcher to make a Windows application portable,
but since this application supports both x86 and x86_64, I
would like to detect the architecture of the OS my launcher is
being run on, in order to launch th
On Sunday, 15 December 2013 at 14:26:26 UTC, Marco Leise wrote:
Am Sun, 15 Dec 2013 15:17:39 +0100
schrieb "Jeroen Bollen" :
Are there default bindings to the WinAPI's Wide Functions? I'm
talking about for example 'CreateWindowW'.
I know of this project:
h
Are there default bindings to the WinAPI's Wide Functions? I'm
talking about for example 'CreateWindowW'.
;dub generate visuald";
this is my project.json:
{
"name": "testing",
"description": "testing",
"authors": ["Jeroen Bollen"],
"dependencies": {
"derelict-sfml2" : "~master",
}
}
On Friday, 6 December 2013 at 14:40:54 UTC, Max Klyga wrote:
On 2013-12-06 13:33:44 +, Jeroen Bollen said:
Are there any Binary Data Serialization Libraries available
written in D2? I'm looking for something like a BSON
read/write library. (Although can be any other binary lan
Are there any Binary Data Serialization Libraries available
written in D2? I'm looking for something like a BSON read/write
library. (Although can be any other binary language really)
On Sunday, 24 November 2013 at 12:07:18 UTC, Dejan Lekic wrote:
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe
wrote:
On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen
wrote:
I added the code to my GitHub repo; there don't seem to be
any uncommon associative a
On Friday, 22 November 2013 at 21:17:56 UTC, monarch_dodra wrote:
On Friday, 22 November 2013 at 19:44:56 UTC, Jeroen Bollen
wrote:
On Friday, 22 November 2013 at 19:22:16 UTC, Ali Çehreli wrote:
import std.bitmanip;
import std.system;
void main()
{
ubyte[] data = [ 1, 2, 3, 4 ];
assert
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe
wrote:
On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen
wrote:
I added the code to my GitHub repo; there don't seem to be any
uncommon associative arrays:
Yea, it is the immutable string[string], I used the same
pa
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe
wrote:
On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen
wrote:
I added the code to my GitHub repo; there don't seem to be any
uncommon associative arrays:
Yea, it is the immutable string[string], I used the same
pa
I added the code to my GitHub repo; there don't seem to be any
uncommon associative arrays:
https://github.com/SanePumpkins/FastCGI.D
On Saturday, 23 November 2013 at 22:49:54 UTC, Adam D. Ruppe
wrote:
On Saturday, 23 November 2013 at 21:05:59 UTC, Jeroen Bollen
wrote:
I am getting this weird linker error when compiling my code;
what does it mean?
I saw this on stackoverflow first and answered there, let me
link it:
http
On Saturday, 23 November 2013 at 22:34:54 UTC, bearophile wrote:
Jeroen Bollen:
I am getting this weird linker error when compiling my code;
what does it mean?
Is your code not compiling since switching to a newer compiler?
What system and compilers are you using? How many modules are
in
On Saturday, 23 November 2013 at 21:32:13 UTC, bearophile wrote:
Jeroen Bollen:
I am getting this weird linker error when compiling my code;
what does it mean?
If your code used to work, and you have just tried dmd 2.064
then as try to compile with -allinst.
Bye,
bearophile
No luck with
I am getting this weird linker error when compiling my code; what
does it mean?
On Saturday, 23 November 2013 at 15:21:02 UTC, Ali Çehreli wrote:
On 11/23/2013 04:08 AM, Jeroen Bollen wrote:
On Friday, 22 November 2013 at 23:12:25 UTC, Ali Çehreli wrote:
That means that the slice itself cannot be modified, meaning
that it
cannot be consumed by read. Can't
On Friday, 22 November 2013 at 23:12:25 UTC, Ali Çehreli wrote:
That means that the slice itself cannot be modified, meaning
that it cannot be consumed by read. Can't work... :)
Why does read need to be able to change the byte array?
On Wednesday, 20 November 2013 at 18:23:37 UTC, Ali Çehreli wrote:
On 11/20/2013 10:12 AM, Jeroen Bollen wrote:
> is there a way I can pass a TypeTulip to a function?
alias TypeTulip = TypeTuple;
;)
> Something like:
>
> Can I create a class array in D? Something like:
>
is there a way I can pass a TypeTulip to a function?
Something like:
Can I create a class array in D? Something like:
interface A {}
class AA: A {}
class AB: A {}
class AC: A {}
ClassList!A list = new ClassList!A {AA, AB, AC};
void testf(ulong testv) {
A a = new list[testv];
}
I know abou
On Monday, 18 November 2013 at 19:12:03 UTC, Ali Çehreli wrote:
On 11/18/2013 10:28 AM, Jeroen Bollen wrote:
Is it possible to do something like:
TestInterface testi = new classReferenceList[integer];
We still don't know what the use case is :) but it is possible
to store types
On Tuesday, 19 November 2013 at 23:36:57 UTC, Rob T wrote:
On Tuesday, 19 November 2013 at 18:35:08 UTC, Jeroen Bollen
wrote:
Is there a way I can call a receive method on a socket with
MSG_WAITALL as a flag? There doesn't seem to be an enum for
that.
module core.sys.posix.sys.s
Is there a way I can call a receive method on a socket with
MSG_WAITALL as a flag? There doesn't seem to be an enum for that.
On Tuesday, 19 November 2013 at 18:09:29 UTC, Namespace wrote:
On Tuesday, 19 November 2013 at 18:01:19 UTC, Jeroen Bollen
wrote:
If I have a function:
@safe pure void functionName() {
return;
}
Where do I put the noexcept?
Did you mean nothrow?
You can put it
If I have a function:
@safe pure void functionName() {
return;
}
Where do I put the noexcept?
On Monday, 18 November 2013 at 19:34:56 UTC, Adam D. Ruppe wrote:
On Monday, 18 November 2013 at 19:32:39 UTC, Jeroen Bollen
wrote:
How do I call a parent class's overidden method?
super.method
so
abstract class SuperClass {
public pure void methodA() {
}
}
class Sub
How do I call a parent class's overidden method?
module test;
abstract class SuperClass {
public pure void methodA() {
}
}
class SubClass {
public override pure void methodB() {
// How do I call the parent methodA() from here?
}
}
Is it possible to do something like:
TestInterface testi = new classReferenceList[integer];
On Saturday, 16 November 2013 at 16:34:31 UTC, Ali Çehreli wrote:
The problem with your example is that unlike main.c in my
example, what you pass is an rvalue, which may not be bound to
the ref parameter.
Thanks, this is what I needed!
On Saturday, 16 November 2013 at 14:28:45 UTC, bearophile wrote:
Jeroen Bollen:
Why is that?
It's caused by the cast. The solution is to use an auxiliary
value inside the main, or remove the cast.
Bye,
bearophile
Same error, but "is not callable using argument types
(TcpSocket)"...
I cannot seem to pass values to functions by referece.
--
@safe public nothrow this(ref Socket socket) {
// Inside class modulename.classname
this.socket = socket;
}
---
I feel there is a lack of resources/documentation on array
definitions. I cannot believe the official documentation tries to
explain how D handles arrays without defining an array a single
time.
http://dlang.org/arrays.html
On Monday, 4 November 2013 at 22:22:32 UTC, Max Klyga wrote:
On 2013-11-04 21:20:46 +, Adam D. Ruppe said:
On Monday, 4 November 2013 at 19:35:55 UTC, Jeroen Bollen
wrote:
Is there a way I can embed javascript into my D application?
You could use any C javascript lib too, but for ones
On Monday, 4 November 2013 at 20:43:46 UTC, John Colvin wrote:
On Monday, 4 November 2013 at 20:18:19 UTC, Jeroen Bollen wrote:
On Monday, 4 November 2013 at 19:45:23 UTC, Dicebot wrote:
On Monday, 4 November 2013 at 19:35:55 UTC, Jeroen Bollen
wrote:
Is there a way I can embed javascript into
On Monday, 4 November 2013 at 19:45:23 UTC, Dicebot wrote:
On Monday, 4 November 2013 at 19:35:55 UTC, Jeroen Bollen wrote:
Is there a way I can embed javascript into my D application? I
basically want to create a modular application which allows
adding and removing plugins by dragging and
Is there a way I can embed javascript into my D application? I
basically want to create a modular application which allows
adding and removing plugins by dragging and dropping them into a
folder. I love the idea of them being editable on the fly.
Is it possible in D to create an enum of class references?
Something around the lines of:
enum ClassReferences : Interface {
CLASS1 = &ClassOne,
CLASS2 = &ClassTwo
}
84 matches
Mail list logo