What is the fastest way to have the detailed debug info for
druntime? I have a program that fails in Fiber constructor after
I create and delete at least 68_209 Fibers one after another. For
68_208 works fine, one more and it aborts. I'm trying to use gdb
to debug, but most likely don't have sy
On Tuesday, 23 August 2016 at 07:17:16 UTC, Jack Applegame wrote:
This is impossible since pointers to local variables are
unknown at compile time.
This is a bit strange, as the local variables aren't known either
and they seem to work. I do not want to get the address, rather
an alias to `&v
Is it possible to generate an argument list that contains
pointers to local variables at compile time?
For example, consider following code:
template Repeat(alias int N, alias variable)
{
// Magic
alias Repeat = /* Even more magic */;
}
void foo(int* x, int* y, int* z)
{
// [...]
On Wednesday, 10 August 2016 at 15:07:52 UTC, Ali Çehreli wrote:
On 08/10/2016 02:05 AM, ciechowoj wrote:
Better with some mixin magic:
mixin template CArray(string symbol, T) {
pragma(mangle, symbol) extern extern(C) __gshared
mixin ("T[0] _c" ~ symbol ~ ";");
@property
mixin (
On Tuesday, 9 August 2016 at 19:16:46 UTC, Ali Çehreli wrote:
Well, C's array symbol is used as a pointer to the first
element and D allows array indexing for pointers as well.
Here is the C code:
// c.c
#include "stdio.h"
int tab[64];
int *get() {
return tab;// or &tab[0]
}
void in
On Tuesday, 9 August 2016 at 19:16:42 UTC, Steven Schveighoffer
wrote:
D has an answer:
pragma(mangle, "tab")
extern extern(C) int[1] _ctab;
@property int* tab() { return _ctab.ptr; }
I still don't recommend doing this, for previously stated
reasons.
This is really interesting :).
On Tuesday, 9 August 2016 at 15:41:08 UTC, Steven Schveighoffer
wrote:
Well, you can via properties:
@property int* tabp() { return tab.ptr; }
tabp[elem];
This is nice. The best would be to have it with the same name as
original symbol, but I can't imagine how it could be done.
Essentiall
On Tuesday, 9 August 2016 at 14:25:15 UTC, Kagamin wrote:
Well
extern extern(C) __gshared int[64] tab;
My assumption is you do not know the size of the array.
On Tuesday, 9 August 2016 at 14:01:17 UTC, Steven Schveighoffer
wrote:
I think this should work:
extern extern(C) int[1] tab;
Then if you want to access the elements, use the tab.ptr[elem]
If it's a global variable, tack on __gshared.
-Steve
I've already tried this and works (64-bit at lea
Is there a way to access a static array from D without knowing
the size of the array?
Let suppose there is an array, somewhere in lib.c.
int tab[64];
and there is header file lib.h with following reference:
extern int tab[];
How to declare `tab` in the D code without knowing the size of
the
On Saturday, 6 August 2016 at 11:58:31 UTC, rikki cattermole
wrote:
We provide Optlink so that we have support for Windows out of
the box. Unfortunately since Optlink does not understand COFF,
we are forced to provide a second command option to force MSVC
tooling for 32bit usage.
That makes s
On Saturday, 6 August 2016 at 12:06:02 UTC, Kai Nacke wrote:
If you are already using Visual Studio and LLVM/clang then why
not use ldc? The compiler itself is built with this toolchain...
I'm considering that option. However, as the project I want to
compile is dstep, I want it to compile s
I managed to compile both 32 and 64 bit release versions and it
seems to work fine, however with 64-bit debug version I'm getting
a strange error:
LINK : fatal error LNK1101: incorrect MSPDB120.DLL version;
recheck installation of this product
Does anyone know why it is so? I'm compiling wit
On Friday, 5 August 2016 at 18:37:43 UTC, Jonathan M Davis wrote:
I know that dmd supports VS' binary format and linker for
64-bit (dmc and optlink were never updated to support 64-bit),
and I think that 32-bit support for using VS' library format
and linker were added later. So, I'm fairly cer
Is default dmd linker (on MS Windows, OPTILINK) supposed to link
against static libraries created with Visual Studio?
Specifically I want to link a project compiled on windows with
dmd against pre-compiled library `libclang.lib` from LLVM suite.
I'm pretty sure they used Visual Studio to compi
On Friday, 29 July 2016 at 12:20:17 UTC, Mike Parker wrote:
Though, I should add the caveat that you need to ensure the
definition of the C function does not specify any parameters.
AFAIK, this is legal:
// foo.h
void func();
// foo.c
void func(int a, int b) { ... }
In which case you would
In C, a function `void func()` doesn't declare a function without
arguments, instead it declares a function that takes unspecified
number of arguments. The correct way to declare a function that
takes no arguments is to use the `void` keyword: `void
func(void)`.
What is the correct way to ref
On Sunday, 5 June 2016 at 21:20:20 UTC, Andrej Mitrovic wrote:
On Thursday, 2 June 2016 at 13:04:00 UTC, ciechowoj wrote:
and found that an assert from `std/path.d:3168` (`globMatch`)
contributes a major amount to the running time of dub.
```
assert(balancedParens(pattern, '[', ']', 0));
Maybe it would be worth to write something about the issue here
https://github.com/dlang/dub#installation . I'm curious how the
pre-compiled versions are built.
On Thursday, 2 June 2016 at 12:20:50 UTC, Jacob Carlborg wrote:
On 2016-06-01 23:33, ciechowoj wrote:
Hahahaa. Who could possibly think that `build.sh` builds dub
in debug
mode? With -release -O -inline -m64 it runs 5 times faster :
P. It made
my day...
Haha really?
Yes, I should have done
Hahahaa. Who could possibly think that `build.sh` builds dub in
debug mode? With -release -O -inline -m64 it runs 5 times faster
: P. It made my day...
On Saturday, 21 May 2016 at 00:39:21 UTC, Jonathan M Davis wrote:
Well, if you actually tried marking functions with pure, you'd
see pretty fast that this won't work with pure. A function
that's marked with pure cannot access any global, mutable
state. It can only access what's passed to it (th
On Friday, 20 May 2016 at 20:45:05 UTC, Jonathan M Davis wrote:
If you want something that's ref-counted and works in pure
code, const will _not_ work, because you can't legally alter
the ref-count.
What about something like this (ignoring multi-threading issues):
struct RefCountPool {
siz
On Friday, 20 May 2016 at 18:23:26 UTC, Jack Applegame wrote:
On Friday, 20 May 2016 at 17:28:55 UTC, Namespace wrote:
But you can cheat:
You can just cast const away:
struct A {
int id = 0;
this(int id) {
this.id = id;
}
void ch
On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote:
On Thursday, May 19, 2016 20:44:54 ciechowoj via
Digitalmars-d-learn wrote:
Is there D equivalent of C++'s mutable keyword? Like the one
that allows to modify a field of struct from constant method.
Or some alternative sol
Is there D equivalent of C++'s mutable keyword? Like the one that
allows to modify a field of struct from constant method. Or some
alternative solution?
On Sunday, 15 May 2016 at 01:48:41 UTC, cy wrote:
dub build --nodeps
It's amazing.
I tried it, doesn't seem to do anything, maybe something is
broken.
On Sunday, 15 May 2016 at 06:49:00 UTC, Russel Winder wrote:
I am not sure about DStep build, but for the two projects I
have (using
GtkD) build times using Dub were sufficiently long that I
switched to
SCons and it is OK and allows for a reasonable development
rhythm.
That SCons looks very n
On Monday, 7 March 2016 at 21:56:11 UTC, Seb wrote:
Use ld.gold - it will speed up your linking quite dramatically!
https://code.dawg.eu/reducing-vibed-turnaround-time-part-1-faster-linking.html
Thanks, it improves things a little. However I've just had idea
that it should be possible to impl
Thus, i need a way to tell the gc to ignore the reference ( or
something similar ) in that hashmap.
So, having pointer that doesn't hold a reference isn't that hard
(store it in memory region that is unreachable to gc), but don't
you need a way to tell if that pointer ins't dangling, beyond
i
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote:
How could i tell the garbage collector to ignore the reference
in the hashmap and to free it if there isn't any other
reference that in my hashmap?
You could always zero the reference in the hashmap, as it won't
be valid after reload any
On Friday, 22 April 2016 at 21:13:31 UTC, anonymousuer wrote:
What code is needed to tell D to open a window? Thank you in
advance.
Could you specify what kind of window do you need?
On Sunday, 13 March 2016 at 13:42:02 UTC, cym13 wrote:
The problem was brought up a few days ago (can't remember
where) and it happens to be a documentation mistake: there is a
clear() method planned but for a future release (the next one?).
That would be great : )
On Saturday, 12 March 2016 at 12:42:04 UTC, Adam D. Ruppe wrote:
On Saturday, 12 March 2016 at 12:34:16 UTC, ciechowoj wrote:
If above doesn't work how am I supposed to clear the array? `x
= string[string].init;` is somewhat ugly.
Read the Tip of the Week section here:
http://arsdnet.net/this
Could someone explain to me, why following code does not compile?
int main()
{
string[string] x = [ "foo" : "bar" ];
x.clear();
x = [];
return 0;
}
Errors:
main.d(7): Error: no property 'clear' for type 'string[string]'
main.d(8): Error: cannot implicitly convert
dub --version
DUB version 0.9.24+161-gb9ce700, built on Feb 23 2016
`dub.json` is `dub.json` of dstep
`dub test --skip-registry=all`
Do not helps.
On Monday, 7 March 2016 at 09:22:16 UTC, Daniel Kozak wrote:
maybe: dub build --nodeps
Dne 7.3.2016 v 10:18 ciechowoj via Digitalmars-d-learn
napsal(a):
I'm using `dub` to build project. And every time I run `dub`
it seems to check if dependencies are up to date, which takes
some tim
I'm using `dub` to build project. And every time I run `dub` it
seems to check if dependencies are up to date, which takes some
time. Is there a way to switch of that checking? Or any other way
to speed up building process? It really slows down my
modify-compile-check iteration time.
It there a way to change how writeln converts structs to strings?
I read in the documentation it uses to!string to convert the
struct. Is there a way to overload to!string for my own type?
Let say I have:
struct Point {
int x, y;
}
and I want writeln(Point(3, 4)); to print "[3, 4]" instea
39 matches
Mail list logo