How does D cope with aliasing

2009-09-05 Thread #ponce
I'm currently using a lot of pointers to perform heavy computation

Has D the equivalent for C's restrict ? More generally, how does D cope with 
the aliasing of pointers ? I think it's crucial for the code optimizer.




Re: How does D cope with aliasing

2009-09-05 Thread Jarrett Billingsley
On Sat, Sep 5, 2009 at 3:49 AM, #poncealil...@gmail.com wrote:
 I'm currently using a lot of pointers to perform heavy computation

 Has D the equivalent for C's restrict ? More generally, how does D cope with 
 the aliasing of pointers ? I think it's crucial for the code optimizer.

It doesn't.


Trying to get DMD bundled with libs

2009-09-05 Thread Joel Christensen
I noticed you can get DMD bundled with various libraries. I found you 
had to login to another web site, but the registery page has 3 must fill 
in textbox's that are crazy.


A writefln issue or a Thread issue?

2009-09-05 Thread Sam Hu
Given below code:

module testWin32Process;

import win32.windows;//get 
from:http://www.dsource.org/projects/bindings/wiki/WindowsApi


import std.string;
import std.conv;
import std.stdio;
import core.stdc.stdlib;


string startupProcess()
{
STARTUPINFO si;
si.cb=si.sizeof;

PROCESS_INFORMATION pi;
char* szCommandLine=cast(char*)toStringz(cmd/*notepad 
testWin32Process.d*/);
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=true;


int bRet=CreateProcess(
null,
szCommandLine,
null,
null,
false,
CREATE_NEW_CONSOLE,
null,
null,
si,
pi);
if(bRet)
{
CloseHandle(pi.hThread);

return std.string.format(New process ID:%d\n
Host process ID:%d\n,
pi.dwProcessId,
pi.dwThreadId);

}
else
{

return Do not know what happend.;//just want to check
}

}
int main(string[] args)
{
writefln(%s\n,toStringz(startupProcess)); // prints blank!!!


MessageBox(null,toStringz(startupProcess),toStringz(result?),0);//prints 
contents as expected!!

system(pause);
return 0;
}

As commented,were I use writefln(...),it prints blank;were I use MessageBox,it 
prints well as expected:

New Process ID:2216
Host Process ID:2456

Could anybody here figure me out what the problem is?Thanks in advance.

Regards,
Sam


Re: A writefln issue or a Thread issue?

2009-09-05 Thread Sam Hu
Fyi:
1.with DMD2032 under windows xp;
2.Tried printf,write,writeln,writef,writefln but all the same result:blank DOS 
console under current exe path;
3.In c/c++ it opens total 2 DOS windows which works properly: the main one and 
the one created by CREATE_NEW_CONSOLE ;but in D it opens total 3 DOS 
consoles,the main one and 2 blank consoles which were created by 
CREATE_NEW_CONSOLE,both under current exe path.


Re: Trying to get DMD bundled with libs

2009-09-05 Thread div0
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joel Christensen wrote:
 I noticed you can get DMD bundled with various libraries. I found you
 had to login to another web site, but the registery page has 3 must fill
 in textbox's that are crazy.

Where's that?
AFAIK nobody has permission to distribute DMD other than Walter.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKokMqT9LetA9XoXwRAovPAJ9Z66+VmFBr5rfOPPD0N2I3Sl2BIgCdFryR
/a05uGyeyprp/bYWOn60HiU=
=Thos
-END PGP SIGNATURE-


Re: A writefln issue or a Thread issue?

2009-09-05 Thread div0
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Sam Hu wrote:
 Fyi:
 1.with DMD2032 under windows xp;
 2.Tried printf,write,writeln,writef,writefln but all the same result:blank 
 DOS console under current exe path;
 3.In c/c++ it opens total 2 DOS windows which works properly: the main one 
 and the one created by CREATE_NEW_CONSOLE ;but in D it opens total 3 DOS 
 consoles,the main one and 2 blank consoles which were created by 
 CREATE_NEW_CONSOLE,both under current exe path.


writefln(%s\n,toStringz(startupProcess)); // prints blank!!!

the toStringz in the writefln is wrong.
You've already returned a string from startupProcess.

The toStringz returns a char* which writefln is printing
as a pointer, so you are seeing something like '974f40' being printed
instead of the message you where expecting.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKokgaT9LetA9XoXwRArHUAJ4yTRoDqyrPlcCk5cdCZ7Yw2+iTSACg0u9w
3tpmYa8ftFEVErLMInIkb1k=
=RgrL
-END PGP SIGNATURE-


Re: How does D cope with aliasing

2009-09-05 Thread bearophile
#ponce:
 I'm currently using a lot of pointers to perform heavy computation  Has D the 
 equivalent for C's restrict ? More generally, how does D cope with the 
 aliasing of pointers ? I think it's crucial for the code optimizer.

DMD probably just doesn't perform such optimizations. LLVM that's under LDC is 
probably able to perform such optimizations, but in the language there is no 
way to give such semantics to the compiler.
My suggestion for you is to ask for such feature in the main D newsgroup, 
and/or in bugzilla. In the meantime you can also ask such feature to LDC 
developers, they may just add a small LDC-specific pragma that gives such 
semantics to the LLVM (in future, when D will add such annotation LDC 
developers will just change the syntax of this feature). (I'll ask to LDC 
developers to see what they think).

Bye,
bearophile


Re: Trying to get DMD bundled with libs

2009-09-05 Thread Jarrett Billingsley
On Sat, Sep 5, 2009 at 6:53 AM, div0d...@users.sourceforge.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Joel Christensen wrote:
 I noticed you can get DMD bundled with various libraries. I found you
 had to login to another web site, but the registery page has 3 must fill
 in textbox's that are crazy.

 Where's that?
 AFAIK nobody has permission to distribute DMD other than Walter.

Some others are allowed to distribute DMD (the Tango team, I think the
EasyD thing), but I've never heard of a site requiring you to fill out
info to get it.


Re: How does D cope with aliasing

2009-09-05 Thread Stewart Gordon

#ponce wrote:

I'm currently using a lot of pointers to perform heavy computation

Has D the equivalent for C's restrict ? More generally, how does D 
cope with the aliasing of pointers ? I think it's crucial for the 
code optimizer.


My recollection of reading the spec is that a D compiler is allowed to 
optimise by assuming no pointer aliasing.  But I can't remember at the 
moment where I read this.


But in the absence of this, you can use contracts to guard against at 
least the simplest forms of aliasing.


Stewart.


Re: Trying to get DMD bundled with libs

2009-09-05 Thread div0
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jarrett Billingsley wrote:
 On Sat, Sep 5, 2009 at 6:53 AM, div0d...@users.sourceforge.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Joel Christensen wrote:
 I noticed you can get DMD bundled with various libraries. I found you
 had to login to another web site, but the registery page has 3 must fill
 in textbox's that are crazy.
 Where's that?
 AFAIK nobody has permission to distribute DMD other than Walter.
 
 Some others are allowed to distribute DMD (the Tango team, I think the
 EasyD thing), but I've never heard of a site requiring you to fill out
 info to get it.

Sounds like it's time to sharpen the pitch forks!

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKows2T9LetA9XoXwRAo5FAJ9asn8ovwg/E8KpfAWkjbQPswnPKQCgl74j
nF9/sPrk/jvcC7XA4wa3sNI=
=jCAv
-END PGP SIGNATURE-