This program comes from a reduction of a bug I've found:
struct Foo {
void init() {}
}
void main() {
Foo*[] foos;
//(*foos[0]).init(); // OK
foos[0].init(); // Error: function expected before (), not null of type Foo*
}
What do you think about the idea of not allowing methods na
I found another workaround: mark the module as trusted.
On Friday, 24 February 2012 at 08:47:14 UTC, Brad Anderson wrote:
On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson
wrote:
There is no documentation (both on dlang.org and in the local
documentation) so I'm not sure if it's supposed to be working
yet. I get linker errors when I try to
Is there another workaround than the one I've posted?
http://d.puremagic.com/issues/show_bug.cgi?id=7577
On Fri, Feb 24, 2012 at 8:44 PM, James Miller wrote:
> Hmm it seems that the delegate is being implicitly marked as system, and im
> not sure why benchmark is @safe. I'd say file a bug report
On Feb 25, 2012 12:16 PM, "Caligo" wrote:
>
> That was a typo, and it doesn't change anything. Here is a shorter
version:
>
> 8<8<
> import std.datetime;
> import std.stdio;
>
> struct A{
>
> auto fun(A a){ return 0; }
> }
>
> void bench(alias fun)
On Feb 25, 2012 9:08 AM, "Zach the Mystic" <
reachzachatgooglesmailserv...@dot.com> wrote:
>
> On 2/23/12 7:33 PM, Ellery Newcomer wrote:
>>>
>>> import std.stdio;
>>>
>>> mixin template helpMe()
>>> {
>>> writeln("Satisfying!");
>>> }
>>
>> does it do that if you replace the statement with a decla
That was a typo, and it doesn't change anything. Here is a shorter version:
8<8<
import std.datetime;
import std.stdio;
struct A{
auto fun(A a){ return 0; }
}
void bench(alias fun)(string msg, uint n = 1_000_000){
auto b = benchmark!fun(n);
On Fri, 24 Feb 2012 21:36:21 +0100, Andrej Mitrovic
wrote:
On 2/24/12, simendsjo wrote:
I don't get it. This gives me a dynamic array, not a static:
char[1] a;
auto b = cast(void*)a;
auto c = (cast(char*)b)[0..1];
c.length = 10; // auch!
You can do:
char[1] c = (cast(
So I'm all trying out this hot new shared switch, and it works just
dandy for -m32 when d has the main function. But now I want to be able
to call my shared lib from C.
my little shared lib, tup.d:
import std.stdio;
extern(C) void xyz(int i){
writeln(i);
}
compiled like so:
dmd -shared
On Fri, Feb 24, 2012 at 09:35:57PM +0100, Jordi Sayol wrote:
> Al 24/02/12 20:45, En/na H. S. Teoh ha escrit:
[...]
> > I personally think that phobos *should* be a shared object at some
> > point, but not everyone agrees with me.
> >
>
> I think that phobos should be a shared object too, but onl
Al 24/02/12 20:45, En/na H. S. Teoh ha escrit:
> On Fri, Feb 24, 2012 at 08:36:03PM +0100, Jordi Sayol wrote:
> [...]
>> better wait till libphobos2.a becomes libphobos2.so
> [...]
>
> You might have to wait a while for that. AFAIK there are no plans
> currently to make phobos available as a share
On 2/24/12, simendsjo wrote:
> I don't get it. This gives me a dynamic array, not a static:
> char[1] a;
> auto b = cast(void*)a;
> auto c = (cast(char*)b)[0..1];
> c.length = 10; // auch!
>
You can do:
char[1] c = (cast(char*)b)[0..1];
On Fri, Feb 24, 2012 at 03:08:18PM -0500, Zach the Mystic wrote:
[...]
> Does any other language come close to D in terms of generics? I don't
> know, I'm just asking?
[...]
AFAIK, no. But then I only have C++ to compare with, and if I understand
it correctly Java and C#'s generics don't even come
On Fri, Feb 24, 2012 at 11:56:18AM -0800, Ali Çehreli wrote:
[...]
> char[1] a;
> auto c = a.ptr[0..a.length];
[...]
Hey, that's an awesome way to implement copy-on-write static arrays!
I'll have to use that sometime. :)
T
--
Sometimes the best solution to morale problems is just to f
On Fri, 24 Feb 2012 20:56:22 +0100, H. S. Teoh
wrote:
24.02.2012 21:34, simendsjo пишет:
>char[] a;
>auto b = cast(void*)a;
>auto c = cast(char[])b; // Error: e2ir: cannot cast b of type
>void* to type char[]
[...]
Just out of curiosity, what are you trying to accomplish with th
On Fri, 24 Feb 2012 20:56:18 +0100, Ali Çehreli wrote:
On 02/24/2012 11:44 AM, simendsjo wrote:
On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear
wrote:
On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:
char[] a;
auto b = cast(void*)a;
auto c = cast(char[])b; // Error: e2ir: cannot cast
On 2/23/12 7:33 PM, Ellery Newcomer wrote:
import std.stdio;
mixin template helpMe()
{
writeln("Satisfying!");
}
does it do that if you replace the statement with a declaration?
like this:
mixin template helpMe()
{
int durrr = (writeln("Satisfying!"), 1);
}
No, it doesn't. You're right. I g
On Fri, Feb 24, 2012 at 04:24:03PM +1300, James Miller wrote:
> On 24 February 2012 12:06, H. S. Teoh wrote:
> > On Fri, Feb 24, 2012 at 04:06:52AM +1300, James Miller wrote:
> >> On 23 February 2012 13:15, BLM wrote:
> >> > After messing around for a while, I figured out what is making
> >> > DM
On 02/24/2012 11:44 AM, simendsjo wrote:
On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear
wrote:
On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:
char[] a;
auto b = cast(void*)a;
auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void*
to
type char[]
Arrays have a length--yo
> 24.02.2012 21:34, simendsjo пишет:
> >char[] a;
> >auto b = cast(void*)a;
> >auto c = cast(char[])b; // Error: e2ir: cannot cast b of type
> >void* to type char[]
[...]
Just out of curiosity, what are you trying to accomplish with this cast?
In almost all normal D code, there's no ne
24.02.2012 21:34, simendsjo пишет:
char[] a;
auto b = cast(void*)a;
auto c = cast(char[])b; // Error: e2ir: cannot cast b of type
void* to type char[]
Generally, you should not cast a struct to pointer and vise-versa.
Besides, size of array structure is larger than size of pointer
On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear
wrote:
On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:
char[] a;
auto b = cast(void*)a;
auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void*
to
type char[]
Arrays have a length--you need to cast the pointe
On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:
> char[] a;
> auto b = cast(void*)a;
> auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void*
> to
> type char[]
Arrays have a length--you need to cast the pointer to a char*, then slice
it.
On Fri, Feb 24, 2012 at 08:34:19PM +0100, simendsjo wrote:
> char[] a;
> auto b = cast(void*)a;
> auto c = cast(char[])b; // Error: e2ir: cannot cast b of type
> void* to type char[]
D arrays are not the same as C arrays. D arrays also include length in
addition to the pointer, so you
On Fri, Feb 24, 2012 at 08:36:03PM +0100, Jordi Sayol wrote:
[...]
> better wait till libphobos2.a becomes libphobos2.so
[...]
You might have to wait a while for that. AFAIK there are no plans
currently to make phobos available as a shared library yet.
I personally think that phobos *should* be a
Al 24/02/12 20:21, En/na Ellery Newcomer ha escrit:
> On 02/24/2012 06:27 AM, Jordi Sayol wrote:
>>
>> It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2
>> (64-bit) without -fPIC argument?
>>
>
> What? -shared works with 32-bit?
>
> Holy crap, it does! this is awesome!
char[] a;
auto b = cast(void*)a;
auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to
type char[]
On 02/24/2012 06:27 AM, Jordi Sayol wrote:
It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2
(64-bit) without -fPIC argument?
What? -shared works with 32-bit?
Holy crap, it does! this is awesome!
maybe make a bug report for 64 bit?
Hello everybody.
When trying to compile a program using GDC (Windows), which
includes an import std.socket, I get a lot "undefined
reference"s, like
undefined reference to `WSAGetLastError@0'
By now I know this happens if there are libraries missing or
similar, but seeing how this is part o
On Friday, 24 February 2012 at 09:22:59 UTC, David wrote:
Am 24.02.2012 01:50, schrieb Chris Pons:
Is the documentation up-to-date on this site? So that I can
search
through and try to learn more about a certain library and how
it could
help me?
Which site? The derelict documentation? There
I have a C function taking a callback function as a parameter. My thought
was to wrap this up using a template, but I cannot get it to work:
extern(C) alias void function() Callback;
template Wrap(alias dg)
{
extern(C) void Wrap()
{
dg();
}
}
void main()
{
Callback cb
On Friday, February 24, 2012 09:43:30 Johannes Pfau wrote:
> try -nophoboslib and/or -nostdinc. However, to use the git phobos
> version with gdc you also have to compile it with gdc. I'm not sure but
> I think the phobos source in gdc has gdc specific changes, at least it's
> that way for druntime
Le 24/02/2012 00:49, Vadim a écrit :
I am looking for the details on D Garbage Collection implementation. I
will much appreciate if someone suggests the answers or give some links
to existing documentation clarifying the following points:
1. Is it Mark-n-Sweep or copy or generational collector o
Actually, looks like you have done it already 2 years ago :)
http://d.puremagic.com/issues/show_bug.cgi?id=4505
On 24/02/12 15:18, Alex Rønne Petersen wrote:
On 24-02-2012 15:08, bearophile wrote:
I have seen this C++11 program:
http://kaizer.se/wiki/log/post/C++_constexpr/
I have translated it to this D code:
bool notEnd(const char *s, const int n) {
return s&& s[n];
}
bool strPrefix(const char *s, co
On 02/23/2012 08:29 PM, bioinfornatics wrote:
Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit :
On 02/23/2012 05:27 PM, bioinfornatics wrote:
dear,
for set soname with:
- gdc: -Xlinker -soname myLib.so.1
- ldc2: -soname myLib.so.1
- dmd: ?
someone know how set soname with dmd ?
dmd
Thank you for checking. I'm guessing that the most likely problem
then is that either my d3d11.lib file is broken, or the build is
not finding it somehow... I'll check later.
Thank you for confiruming it basically works :)
On 24-02-2012 15:08, bearophile wrote:
I have seen this C++11 program:
http://kaizer.se/wiki/log/post/C++_constexpr/
I have translated it to this D code:
bool notEnd(const char *s, const int n) {
return s&& s[n];
}
bool strPrefix(const char *s, const char *t, const int ns, const int nt)
mist:
> Are there any reasons for this inconsistency?
I don't know. Maybe it's just a parser bug. There are some of those in Bugzilla.
If you don't like it, then I suggest you to add it to D Bugzilla.
Bye,
bearophile
I have seen this C++11 program:
http://kaizer.se/wiki/log/post/C++_constexpr/
I have translated it to this D code:
bool notEnd(const char *s, const int n) {
return s && s[n];
}
bool strPrefix(const char *s, const char *t, const int ns, const int nt) {
return (s == t) ||
!t[nt]
Le jeudi 23 février 2012 à 18:35 -0600, Ellery Newcomer a écrit :
> grumph. is it not possible to fix the packages in repo?
>
> On 02/23/2012 05:17 PM, bioinfornatics wrote:
> > get latest ldc build here:
> > http://koji.fedoraproject.org/koji/buildinfo?buildID=299767
> >
> > install it with yum i
Al 24/02/12 11:59, En/na David ha escrit:
>>
>> Are you able to build dynamic libraries directly with DMD?
>> How?
> -sharedgenerate shared library
>
It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2
(64-bit) without -fPIC argument?
Another thing.
$ dmd -fPIC
On 2/23/2012 5:03 PM, John Burton wrote:
I'm trying to use the d3d11 bindings in
http://www.dsource.org/projects/bindings/wiki/DirectX to call
direct3d11 functions from my D program.
I've managed to get the code to compiler but when it links I get
this error -
Error 42 Symbol Undefined _D3D11Cr
Ok, finally understood.
I was trying to declare hof like this: void f2( pure int
function() param ) , similar to the way I declare usual pure
functions. Looks like it is syntax error and only void f2( int
function() pure param ) is allowed. That led me to false
conclusion, that such signature
Al 24/02/12 11:59, En/na David ha escrit:
>>
>> Are you able to build dynamic libraries directly with DMD?
>> How?
> -sharedgenerate shared library
>
I got this:
$ dmd -fPIC -shared foo.d
/usr/bin/ld: /usr/lib/libphobos2.a(minfo.o): relocation R_X86_64_32 against
`.data' can not be used
Am 24.02.2012 11:40, schrieb Jordi Sayol:
Al 23/02/12 20:29, En/na bioinfornatics ha escrit:
Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit :
On 02/23/2012 05:27 PM, bioinfornatics wrote:
dear,
for set soname with:
- gdc: -Xlinker -soname myLib.so.1
- ldc2: -soname myLib.so.1
- dmd:
Al 23/02/12 20:29, En/na bioinfornatics ha escrit:
> Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit :
>> On 02/23/2012 05:27 PM, bioinfornatics wrote:
>>> dear,
>>> for set soname with:
>>> - gdc: -Xlinker -soname myLib.so.1
>>> - ldc2: -soname myLib.so.1
>>> - dmd: ?
>>>
>>> someone know
Am 24.02.2012 01:50, schrieb Chris Pons:
Is the documentation up-to-date on this site? So that I can search
through and try to learn more about a certain library and how it could
help me?
Which site? The derelict documentation? There is no real derelict
documentation, but you normally dont nee
On Fri, 24 Feb 2012 10:06:33 +0100, simendsjo wrote:
Given the header file mymodule.h:
void f(void);
I'm creating mymodule.d:
extern(C) void f();
It works fine when compiling with this library, but when I compile with
-unittest, I get undefined reference to ModuleInfo:
sample.o:(.data+0x210
Given the header file mymodule.h:
void f(void);
I'm creating mymodule.d:
extern(C) void f();
It works fine when compiling with this library, but when I compile with
-unittest, I get undefined reference to ModuleInfo:
sample.o:(.data+0x210): undefined reference to
`_D7mylibrary7mymodule12__Mo
On 24.02.2012 10:28, Caligo wrote:
8<8<
import std.datetime : benchmark;
import std.stdio : writefln;
struct A(int r, int c){
public:
alias float[r * c] Data;
Data _data;
auto opBinary(A a){
float t;
foreach(i; 0..r*c)
On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson wrote:
There is no documentation (both on dlang.org and in the local
documentation) so I'm not sure if it's supposed to be working
yet. I get linker errors when I try to use it:
$ dmd netcurl.d
OPTLINK (R) for Win32 Release 8
Am Thu, 23 Feb 2012 20:21:57 -0800
schrieb "H. S. Teoh" :
> I'm trying to test if a bug has been fixed in the latest Phobos git
> repository, but I'm having trouble convincing gdc to *not* use the
> default installation of Phobos. What option do I need on the
> commandline to tell it to use a diff
There is no documentation (both on dlang.org and in the local
documentation) so I'm not sure if it's supposed to be working
yet. I get linker errors when I try to use it:
$ dmd netcurl.d
OPTLINK (R) for Win32 Release 8.00.12
Copyright (C) Digital Mars 1989-2010 All rights reserve
54 matches
Mail list logo