Memory mapped IO

2011-01-09 Thread Dan Olson
I'm exploring D for embedded work as a nice alternative to C/C++ for the 32-bitters and am finding it has a nice set of features. But, what is the best way handle memory mapped IO? I don't see volatile like in C. Is writing asm {} the best way to ensure memory access? Thanks, Dan Olson

Re: File.size() is a ulong

2011-01-09 Thread Jonathan M Davis
On Sunday 09 January 2011 05:29:47 bearophile wrote: > From a recent update in File I've seen that size() returns an ulong, given > by seek(): > http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?re > v=2284#L585 > http://www.dsource.org/projects/phobos/browser/trunk/phobos/std

Re: Implicit type conversion

2011-01-09 Thread Jonathan M Davis
On Saturday 08 January 2011 13:16:54 Michal Minich wrote: > Use case: > > import std.variant; > > void foo (Variant v) {} > > void main () { > Variant v = 3; // ok, this () called > v = 3; // ok, opAssing called > foo (v); // ok, struct copy, this(this) called >

Re: use of regex -- PS

2011-01-09 Thread Jesse Phillips
If you want your regular expression which matches at the begging of the string you use ^ (carrot). A regex is for describing what it takes to make a match, if your regex doesn't use this than it can match anywhere in the string. So to me having a match and find is redundant. I mean what does fin

Re: use of regex

2011-01-09 Thread Jesse Phillips
spir Wrote: > Hello, > > After getting a MatchResult by calling match(source, engine): Seems that, if > match has failed, calling result.hit() throws an assertion error. Then, how > can I know whether match was successful? As there is always a matchResult > object returned. I'm looking for a k

Re: writef vs writeln and printing to the console

2011-01-09 Thread Christopher Nicholson-Sauls
On 01/09/11 06:52, Andrej Mitrovic wrote: > *I meant I converted them to writef, not writefln, and got a different > behavior*. writefln works fine. Okay, gotcha. I'll agree that the behavioral change is unexpected (when coming from C). I believe there was actually a long discussion a while back

use of regex -- PS

2011-01-09 Thread spir
Hello again, I also have an issue with the func 'match': instead of simply trying to match and fail if not found, it seems to search for a matching snippet all along the source: what a method 'find' or 'search' usually does, as opposed to 'match' precisely. Thus, i'm forced to prefix all regex

Re: dmc can't find masm386 in path when building druntime

2011-01-09 Thread Andrej Mitrovic
Sorry, it's not an issue with DMC. It's an issue with Walter's make from the looks of it. I'm still trying to figure out why it can't find masm though..

dmc can't find masm386 in path when building druntime

2011-01-09 Thread Andrej Mitrovic
I don't know what it is with DMC, but it's unable to find masm386 in my path. Take a look: D:\DMD\dmd2\src\druntime>dmc -c src\rt\minit.asm masm386 -DM_I386=1 -D_WIN32 -Mx src\rt\minit.asm; Can't run 'masm386', check PATH But if I run it manually: D:\DMD\dmd2\src\druntime>masm386 -DM_I386=1 -D_

use of regex

2011-01-09 Thread spir
Hello, After getting a MatchResult by calling match(source, engine): Seems that, if match has failed, calling result.hit() throws an assertion error. Then, how can I know whether match was successful? As there is always a matchResult object returned. I'm looking for a kind of success.failure fl

Re: File.size() is a ulong

2011-01-09 Thread spir
On Sun, 09 Jan 2011 08:29:47 -0500 bearophile wrote: > From a recent update in File I've seen that size() returns an ulong, given by > seek(): > http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?rev=2284#L585 > http://www.dsource.org/projects/phobos/browser/trunk/phobos/std

Re: druntime

2011-01-09 Thread Jacob Carlborg
On 2011-01-09 04:02, Jonathan M Davis wrote: On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote: where did libdruntime.a go in dmd.2.051.zip:/linux/lib ? I think that it's included inside of libphobos.a now, and has been for a few releases. The libraries are still separate, and you can

File.size() is a ulong

2011-01-09 Thread bearophile
>From a recent update in File I've seen that size() returns an ulong, given by >seek(): http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?rev=2284#L585 http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?rev=2284#L1245 It uses fseek, that seems to return

Re: writef vs writeln and printing to the console

2011-01-09 Thread Andrej Mitrovic
*I meant I converted them to writef, not writefln, and got a different behavior*. writefln works fine.

Re: writef vs writeln and printing to the console

2011-01-09 Thread Andrej Mitrovic
On 1/9/11, Christopher Nicholson-Sauls wrote: > What Jesse said, but also: I can't help wondering if there's a special > reason why you cannot (or would rather not) use writefln(".")? > Oh it's not a problem. I was converting some C code and it used printf's with embedded newlines in the stri

Re: interface function overloading

2011-01-09 Thread bearophile
%u: > What is the deeper problem in this little snippet? > Or do you mean there is something wrong if you encounter this pattern. You are right, sorry :-) Bye, bearophile

Re: interface function overloading

2011-01-09 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > %u: > > func(cast(I2)(new C())); > That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ). > Bye, > bearophile Extract the construction and you get: module main; interface I1{} interface I2 : I1{} class C : I2{

Re: writef vs writeln and printing to the console

2011-01-09 Thread Christopher Nicholson-Sauls
On 01/08/11 17:03, Jesse Phillips wrote: > Andrej Mitrovic Wrote: > >> Unfortunately I can't provide a simple test case, but I have a case where >> using: >> >> writef("..\n"); >> >> inside a loop that runs a dozen times does not print out each line as the >> statement is reached, instea

Re: dmd compile with imported modules

2011-01-09 Thread useo
I solved the problem by copying the source files from my shared vm- folder to my desktop in my vm.

Re: dmd compile with imported modules

2011-01-09 Thread useo
I just compiled xfbuild on 32bit ubuntu, but when I try to compile, I get the following error: Build failed: /usr/include/d/dmd/druntime/import/core/stdc/errno.o: Invalid cross-device link. Does anyone know how to solve this problem?

Re: interface function overloading

2011-01-09 Thread bearophile
%u: > func(cast(I2)(new C())); That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ). Bye, bearophile