Re: Separate Piping of dmd stdout and stderr through ddemangle

2014-05-22 Thread simendsjo via Digitalmars-d-learn
On 05/22/2014 11:29 AM, "Nordlöw" wrote: > Is there a Bash way to pipe stdout and stderr *separately* through > ddemangle? > > I'm aware of > > 2>&1 > > but this removes separation of stdout and stderr. 2>&1 means "redirect file handle 2 to the same as file handle 1". So it will redirect st

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 03:54 PM, Adam D. Ruppe wrote: > On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: >> Question: How do I use it from D? > > Write the prototype in your D file with extern(C): > extern(C) int factorial(int n); > > then just call the function normally in D. Make sure you inclu

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 04:22 PM, Adam D. Ruppe wrote: > On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: >> I believe the correct answer should be "Buy my book!". > > ah, of course! I should just make a .sig file lol > > http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/

Re: rehabilitating Juno

2014-06-21 Thread simendsjo via Digitalmars-d-learn
On 06/21/2014 06:40 AM, Jesse Phillips wrote: > On Thursday, 19 June 2014 at 15:24:41 UTC, Jesse Phillips wrote: >> Once I get some examples compiling again in 32bit, it should be easier >> for you to play around with COM in D. > > I've pushed changes which get the library building and examples wo

Re: Concatenates int

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 02:22 PM, Rikki Cattermole wrote: > On 11/07/2014 12:11 a.m., Sean Campbell wrote: >> i have the ints 4, 7, 0 and 1 how can i Concatenate them into four >> thousand seven hundred and one. > > If we talking at compile time definition: > > int myint = 4_7_0_1; > > Would work. > Howev

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 06:05 PM, Alexandre wrote: > I have a string X and I need to insert a char in that string... > > auto X = "100"; > > And I need to inser a ',' in position 3 of this string..., I try to use > the array.insertInPlace, but, not work... > > I try this: > auto X = "1

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 09:58 PM, Alexandre wrote: > basically format > I read a cobol struct file... > > From pos X to Y I have a money value... but, this value don't have any > format.. > > 0041415 > > The 15 is the cents... bascally I need to put the ( comma ), we use > comma to separate th

Re: Using enum constant from different modules

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 10:47 PM, "Marc Schütz" " wrote: > On Thursday, 10 July 2014 at 20:27:39 UTC, Jacob Carlborg wrote: >> Here's a code example: >> >> module main; >> >> import foo; >> >> enum Get = "GET"; >> >> void bar (string a) >> { >> assert(a is Get); >> } >> >> void main () >> { >> asd();

Re: Using enum constant from different modules

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/11/2014 01:08 AM, sigod wrote: > On Thursday, 10 July 2014 at 20:59:17 UTC, simendsjo wrote: >> Strings behaves a bit odd with is(). The following passes: >> >> import std.stdio; >> void f(string a, string b) { >> assert(a is b); // also true >> } >> void main() { >> string a = "aoeu"

Re: monodevelop mono-d versions

2014-08-01 Thread simendsjo via Digitalmars-d-learn
On 08/01/2014 03:15 PM, Dicebot wrote: > (...) or use /opt/ bundle by simendsjo By Alexander Bothe. The files are just hosted at my domain.

Re: Best practices for testing functions that opens files

2014-08-06 Thread simendsjo via Digitalmars-d-learn
On 08/06/2014 01:22 AM, splatterdash wrote: > Hi all, > > Is there a recommended way to test functions that opens and iterates > over files? The unittest block seems more suited for testing functions > whose input and output can be defined in the program itself. I'm > wondering if there is a bette

safe pure unittest

2014-08-13 Thread simendsjo via Digitalmars-d-learn
This is the first time I've seen attributes on unittests: https://github.com/D-Programming-Language/phobos/pull/2349/files#diff-ba05e420ac1da65db044e79304d641b6R179 Has this always been supported? I guess it's good practice to add these on unittests too, but does people even know about this featur

Re: safe pure unittest

2014-08-13 Thread simendsjo via Digitalmars-d-learn
On 08/13/2014 02:50 PM, Dicebot wrote: > On Wednesday, 13 August 2014 at 12:26:02 UTC, simendsjo wrote: >> This is the first time I've seen attributes on unittests: >> https://github.com/D-Programming-Language/phobos/pull/2349/files#diff-ba05e420ac1da65db044e79304d641b6R179 >> >> >> Has this always

std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
Using DMD 2.066 on GNU/Linux x86_64. This is strange: import std.stdio; void main() { auto f = tmpfile(); pragma(msg, typeof(f)); // shared(_IO_FILE)* } But stdio.d looks like the following: static File tmpfile() @safe What is going on here?

Re: std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 07:56 PM, simendsjo wrote: > Using DMD 2.066 on GNU/Linux x86_64. > > This is strange: > > import std.stdio; > void main() { > auto f = tmpfile(); > pragma(msg, typeof(f)); // shared(_IO_FILE)* > } > > But stdio.d looks like the following: > static File tmpfile() @safe

Re: std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 08:09 PM, anonymous wrote: > On Sunday, 24 August 2014 at 17:55:05 UTC, simendsjo wrote: >> Using DMD 2.066 on GNU/Linux x86_64. >> >> This is strange: >> >> import std.stdio; >> void main() { >> auto f = tmpfile(); >> pragma(msg, typeof(f)); // shared(_IO_FILE)* >> } >> >> Bu

File.tmpfile() cannot be used as a pipe?

2014-08-24 Thread simendsjo via Digitalmars-d-learn
I don't know the arguments for my process before reading some of stdin. I was thinking I could solve this by creating a temporary file as a "stdin buffer" while I found out the correct argument and could launch the process. Unfortunately, this fails. Error: 'object.Exception@std/stdio.d(2070): Enf

Re: File.tmpfile() cannot be used as a pipe?

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 09:03 PM, simendsjo wrote: > I don't know the arguments for my process before reading some of stdin. > I was thinking I could solve this by creating a temporary file as a > "stdin buffer" while I found out the correct argument and could launch > the process. Unfortunately, this fails.

Why hide a trusted function as safe?

2015-07-26 Thread simendsjo via Digitalmars-d-learn
Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The reason I ask is because I found the following in std.concurrency: @property Tid this

Re: GC stats

2015-07-26 Thread simendsjo via Digitalmars-d-learn
On Sunday, 26 July 2015 at 14:16:46 UTC, Gary Willoughby wrote: On Saturday, 25 July 2015 at 17:43:44 UTC, Martin Nowak wrote: On Saturday, 25 July 2015 at 17:34:26 UTC, Márcio Martins wrote: What I want is a clean non-intrusive way to log when a collection happened, how long my threads were st

No Unix socket support?

2015-07-29 Thread simendsjo via Digitalmars-d-learn
Is there no Unix socket support in Phobos? Or vibe? Or any other library? I've found some discussions: * https://issues.dlang.org/show_bug.cgi?id=9384 * http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/10870/ , but it seems there are no support yet.

Re: alias overloading strange error

2015-07-31 Thread simendsjo via Digitalmars-d-learn
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote: //Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a var