Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays of chars. If I join

Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays

Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays

ddoc patterns

2011-04-07 Thread spir
Hello, In D stdlib's ddoc the idiom $(D some d code) is constantly used. But it does not work by me. Not only it's not interpreted, but the contents are stripped out all together. (A *very* big bug of ddoc.) First, I'd like to know why. Second, there is another pattern $(D_CODE some d code),

D programs linked with C/MPI based libraries

2011-04-07 Thread Dominic Jones
Hello, Is it possible to call within a D driver program library functions which are programmed in C/C++ with the message passing interface (MPI)? I want to write a program which makes use of the ParMetis library (http://glaros.dtc.umn.edu/gkhome/metis/parmetis/overview). Supposing it is

Re: ddoc patterns

2011-04-07 Thread spir
On 04/07/2011 10:20 AM, spir wrote: Hello, In D stdlib's ddoc the idiom $(D some d code) is constantly used. But it does not work by me. Not only it's not interpreted, but the contents are stripped out all together. (A *very* big bug of ddoc.) First, I'd like to know why. Second, there is

Re: null Vs [] return arrays

2011-04-07 Thread Regan Heath
On Tue, 05 Apr 2011 18:46:06 +0100, Steven Schveighoffer schvei...@yahoo.com wrote: On Tue, 05 Apr 2011 13:24:49 -0400, Regan Heath re...@netmail.co.nz wrote: On Fri, 01 Apr 2011 18:23:28 +0100, Steven Schveighoffer schvei...@yahoo.com wrote: assert( !is null); // works on D. Try it.

Re: ddoc patterns

2011-04-07 Thread bearophile
spir: I take the opprtunity to ask another question: does anyone know how to tag a *span* of text as literal/uninterpreted (either in html or css). The issue is pre makes a *block*, even if not inside a div or p; I desperately need the same feature for inline pieces of code. Try:

Re: [SOLVED] [BUG?] Re: error Not the start of the UTF-8 sequence

2011-04-07 Thread Kagamin
spir Wrote: I get this error message: Not the start of the UTF-8 sequence if it's '\0', the error message is clearly incorrect, report a bug.

Re: null Vs [] return arrays

2011-04-07 Thread Kagamin
bearophile Wrote: Regan Heath: conceptually it's nice to be able to express (exists but is empty) and (does not exist). You may want to express that, but for the implementation of the language those two situations are the same, because in the [] literal the ptr is null. So I think

Re: ddoc patterns

2011-04-07 Thread spir
On 04/07/2011 12:53 PM, bearophile wrote: spir: I take the opprtunity to ask another question: does anyone know how to tag a *span* of text as literal/uninterpreted (either in html or css). The issue is pre makes a *block*, even if not inside adiv orp; I desperately need the same feature for

Re: ddoc patterns

2011-04-07 Thread Jacob Carlborg
On 2011-04-07 12:25, spir wrote: On 04/07/2011 10:20 AM, spir wrote: Hello, In D stdlib's ddoc the idiom $(D some d code) is constantly used. But it does not work by me. Not only it's not interpreted, but the contents are stripped out all together. (A *very* big bug of ddoc.) First, I'd like

Re: incompatible types!

2011-04-07 Thread Steven Schveighoffer
On Wed, 06 Apr 2011 12:32:37 -0400, simendsjo simen.end...@pandavre.com wrote: Both the d1 and d2 homepage states the following: There are two versions of the language: 1. D version 1 which is in maintenance mode. 2. D version 2 which is recommended for new projects. Should it mention

Re: Strange bug in std.concurrency.spawn

2011-04-07 Thread Nick Treleaven
On Tue, 05 Apr 2011 01:19:08 -0300, Jose Armando Garcia wrote: dmd can compile and run to follow the code: unittest { spawn(fun); } void fun(int i) { writeln(i); } Which if you are lucky segfaults and if you are unlucky prints garbage! The problem is that spawn doesn't checks

Re: char[][] join == string

2011-04-07 Thread Simen kjaeraas
On Thu, 07 Apr 2011 02:13:16 +0200, bearophile bearophileh...@lycos.com wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of

use of C memmove

2011-04-07 Thread spir
Hello, I'm trying to use C's memmove as a tool to delete or insert a slice from/into an array. But I cannot manage to do it: systematic segmentation fault. What is wrong below? import std.c.string : memmove; // void *memmove(void *dest, const void *src, size_t n); void moveEnd (E) (E[]

Re: ddoc patterns

2011-04-07 Thread spir
On 04/07/2011 03:32 PM, Jacob Carlborg wrote: On 2011-04-07 12:25, spir wrote: On 04/07/2011 10:20 AM, spir wrote: Hello, In D stdlib's ddoc the idiom $(D some d code) is constantly used. But it does not work by me. Not only it's not interpreted, but the contents are stripped out all

Re: use of C memmove

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 13:09:05 -0400, spir denis.s...@gmail.com wrote: Hello, I'm trying to use C's memmove as a tool to delete or insert a slice from/into an array. But I cannot manage to do it: systematic segmentation fault. What is wrong below? import std.c.string : memmove; // void

Re: char[][] join == string

2011-04-07 Thread Ali Çehreli
On 04/07/2011 01:04 AM, spir wrote: On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in

Re: D programs linked with C/MPI based libraries

2011-04-07 Thread Kagamin
Dominic Jones Wrote: Hello, Is it possible to call within a D driver program library functions which are programmed in C/C++ with the message passing interface (MPI)? I want to write a program which makes use of the ParMetis library

Re: use of C memmove

2011-04-07 Thread Kagamin
spir Wrote: // If move down, compress array. if (offset 0) elements.length += offset; ow, addAssign works on length?

Re: use of C memmove

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 14:44:28 -0400, Kagamin s...@here.lot wrote: spir Wrote: // If move down, compress array. if (offset 0) elements.length += offset; ow, addAssign works on length? Since 12/09 :) http://www.digitalmars.com/d/2.0/changelog.html#new2_037 -Steve

Re: char[][] join == string

2011-04-07 Thread Jesse Phillips
spir Wrote: unittest { string s = abc; char[] chars = cast(char[])s; chars ~= de; s = cast(string) chars; writeln(s, ' ', chars); // abcde abcde chars[1] = 'z'; writeln(s, ' ', chars); // azcde azcde } s's chars are mutable ;-) So, I guess there is /really/ no reason for

Adding days to std.datetime.Date

2011-04-07 Thread Piotr Szturmaj
Is it possible to add a particular number of days to a Date? I have number of days since 1 Jan 2000 and I want to convert it to Date: int days = read!int; // number of days since 1 Jan 2000 Date x = Date(2000, 1, 1); x.add!days(days); Unfortunately add() does not support adding days. Will it

Re: use of C memmove

2011-04-07 Thread spir
On 04/07/2011 08:12 PM, Steven Schveighoffer wrote: On Thu, 07 Apr 2011 13:09:05 -0400, spir denis.s...@gmail.com wrote: Hello, I'm trying to use C's memmove as a tool to delete or insert a slice from/into an array. But I cannot manage to do it: systematic segmentation fault. What is wrong

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread simendsjo
On 05.04.2011 22:04, Steven Schveighoffer wrote: On Tue, 05 Apr 2011 15:24:46 -0400, simendsjo simen.end...@pandavre.com wrote: I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is given control, that is, gets the

Re: D programs linked with C/MPI based libraries

2011-04-07 Thread Jesse Phillips
Dominic Jones Wrote: Hello, Is it possible to call within a D driver program library functions which are programmed in C/C++ with the message passing interface (MPI)? I want to write a program which makes use of the ParMetis library

Re: Adding days to std.datetime.Date

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 15:07:02 -0400, Piotr Szturmaj bncr...@jadamspam.pl wrote: Is it possible to add a particular number of days to a Date? I have number of days since 1 Jan 2000 and I want to convert it to Date: int days = read!int; // number of days since 1 Jan 2000 Date x = Date(2000, 1,

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 15:22:10 -0400, simendsjo simen.end...@pandavre.com wrote: On 05.04.2011 22:04, Steven Schveighoffer wrote: However, a does not end on the master slice, so its capacity is 0. Note that technically using a[1..$] is undefined at this point since the runtime

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 15:22:10 -0400, simendsjo simen.end...@pandavre.com wrote: I'm having some problems explaining it as I'm not sure about the correct terminology (I should have drawn some pictures..), but I'll try. The runtime doesn't track the original array and the slices (for this

Re: Adding days to std.datetime.Date

2011-04-07 Thread Piotr Szturmaj
Steven Schveighoffer wrote: On Thu, 07 Apr 2011 15:07:02 -0400, Piotr Szturmaj bncr...@jadamspam.pl wrote: Is it possible to add a particular number of days to a Date? I have number of days since 1 Jan 2000 and I want to convert it to Date: int days = read!int; // number of days since 1 Jan

Re: char[][] join == string

2011-04-07 Thread bearophile
Jesse Phillips: Casting to and from string/char[] is very dangerous, even through assumeUnique. AssumeUnique is intended to be used for returning a mutable as immutable from a function. Casting is often a no-op for the CPU and as you discovered removes any safety provided by the type

How to handle assert() in Windows GUI apps?

2011-04-07 Thread Andrej Mitrovic
It turns out that using assert() that throws in a Windows application will show an error such as this: --- first.exe - Application Error --- The instruction at 0x00411e6a referenced memory at 0x0044. The memory could not be read.

Re: How to handle assert() in Windows GUI apps?

2011-04-07 Thread Andrej Mitrovic
Oh I'm so stupid I didn't realize my commands were outside the try catch statement.

Re: How to handle assert() in Windows GUI apps?

2011-04-07 Thread Andrej Mitrovic
Everything works fine now, please disregard my silly thread. :)

Compiling DMD

2011-04-07 Thread Nick Sabalausky
Is the makefile supposed to work out-of-the-box, or is it expected that it be edited first? Because when I do make -f win32.mak form the src dir I just get Error: '\dm\bin\dmc' not found. Same (exact same) result if I do make -f win32.mak D=path_to_parent_of_dm. I know I can just hack the

How to run DMD's tests?

2011-04-07 Thread Nick Sabalausky
Like the subject says. I try to use the makefile, but I keep getting this: Error on line 76: expecting target : dependencies