Re: stdout redirect

2015-04-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/04/2015 1:12 a.m., FreeSlave wrote: On Sunday, 12 April 2015 at 04:39:06 UTC, Philip Stuckey wrote: why not: import std.stdio; stdout = File(args[4], "w+"); stderr = File(args[4], "w+"); It just replaces the object, not redirects output. E.g. if you use printf somewhere it will use stdou

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Apr 12, 2015 at 02:33:03PM +, ketmar via Digitalmars-d-learn wrote: > On Sun, 12 Apr 2015 14:18:21 +, JR wrote: > > > But the compiler has all the pieces of information needed to see > > it's wrong, doesn't it? > > no, it doesn't. compiler doesn't know about `std.format.format` an

Re: IMAP library

2015-04-12 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 12 April 2015 at 17:27:32 UTC, Jens Bauer wrote: I won't say it's impossible, but it would be cumbersome processing email on an AVR. I do miss the days of having to work within very real hardware constraints to achieve something only just about achievable. But part of the joy goe

Re: IMAP library

2015-04-12 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 11 April 2015 at 22:45:39 UTC, Laeeth Isharc wrote: Yes - nice to know it can do that also. For me I need to have a way of managing large amounts of email (I have about 2mm messages) including for natural language processing etc. Dovecot/sieve + pipe facility is ok, but not per

Re: vibed - best approach to manage central state (cached records)

2015-04-12 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 12 April 2015 at 10:04:53 UTC, Marc Schütz wrote: On Saturday, 11 April 2015 at 19:24:22 UTC, Laeeth Isharc wrote: Hi. Two questions: 1. On startup I load various indexes from file storage into memory in the shared static this segment, and I would like to access these from threads

Re: Trouble in converting C code to D

2015-04-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-12 11:57, Suliman wrote: Oh in gdal.d there is comment: /* * The enum CPLErr is defined in the header file cpl_error.h. I have not * for the time being included a binding to that header, but have just * imported this single symbol from it. * * Similarly, GDALProgressF

Re: Trouble in converting C code to D

2015-04-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-12 11:53, Suliman wrote: But could you explain why if binding have next string: enum CPLErr { CE_None = 0, CE_Debug = 1, CE_Warning = 2, CE_Failure = 3, CE_Fatal = 4 } I can't use: if( GDALGetGeoTransform( hDataset, adfGeoTransform.ptr ) == CE_None ) In D

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread John Colvin via Digitalmars-d-learn
On Sunday, 12 April 2015 at 14:18:23 UTC, JR wrote: I was chatting with a friend and showed him how printf("%s") printed random memory in C I'm pretty sure modern C compilers will warn about something as obviously wrong as this.

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Apr 2015 14:18:21 +, JR wrote: > But the compiler has all the pieces of information needed to see it's > wrong, doesn't it? no, it doesn't. compiler doesn't know about `std.format.format` and it's special abilities. while it is possible to add such checks to the compiler, it will

writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread JR via Digitalmars-d-learn
I was chatting with a friend and showed him how printf("%s") printed random memory in C, whereas writefln("%s") in D threw an Exception upon execution. It's probably not a completely fair comparison but that's a different topic. I admit to being confused as to why it passed compilation at all

Re: why cant function parameters be grouped by type ?

2015-04-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Apr 2015 11:49:18 +, Baz wrote: > Is there anything in the grammar that prevents this syntax ? yes: nameless args. i would like to see 'em burned with napalm, but it seems to be too late to do that... signature.asc Description: PGP signature

Re: stdout redirect

2015-04-12 Thread FreeSlave via Digitalmars-d-learn
On Sunday, 12 April 2015 at 04:39:06 UTC, Philip Stuckey wrote: why not: import std.stdio; stdout = File(args[4], "w+"); stderr = File(args[4], "w+"); It just replaces the object, not redirects output. E.g. if you use printf somewhere it will use stdout, not file.

Re: why cant function parameters be grouped by type ?

2015-04-12 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 12 April 2015 at 11:49:19 UTC, Baz wrote: Hi, while variable declarations work in list: uint a,b,c; function parameters declarations don't: void foo(uint a,b,c); Because of this, function declarations are sometimes super-wide. (despite of the fact that: http://www.brainyquote.

why cant function parameters be grouped by type ?

2015-04-12 Thread Baz via Digitalmars-d-learn
Hi, while variable declarations work in list: uint a,b,c; function parameters declarations don't: void foo(uint a,b,c); Because of this, function declarations are sometimes super-wide. (despite of the fact that: http://www.brainyquote.com/quotes/quotes/a/alanperlis177279.html) In the pr

Re: vibed - best approach to manage central state (cached records)

2015-04-12 Thread via Digitalmars-d-learn
On Saturday, 11 April 2015 at 19:24:22 UTC, Laeeth Isharc wrote: Hi. Two questions: 1. On startup I load various indexes from file storage into memory in the shared static this segment, and I would like to access these from threads serving web requests. The data can be considered immutable

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
Oh in gdal.d there is comment: /* * The enum CPLErr is defined in the header file cpl_error.h. I have not * for the time being included a binding to that header, but have just * imported this single symbol from it. * * Similarly, GDALProgressFunc is defined in port/cpl_progress.h

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
Jacob, thanks! double [6] adfGeoTransform; if( GDALGetGeoTransform( hDataset, adfGeoTransform.ptr ) == 0 ) { writeln(adfGeoTransform[1]); } But could you explain why if binding have next string: enum CPLErr { CE_None = 0, CE_Debug = 1, CE_Warning = 2, CE_Failure = 3

Re: Trouble in converting C code to D

2015-04-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-12 11:19, Suliman wrote: So I got GDAL binding work. And now I need to understand how to translate C code to D. Here is simple tutorial: http://www.gdal.org/gdal_tutorial.html If I right understand it's easier to take C, than C++ code example. Now I am trying to get very simple examp

Re: Trouble in converting C code to D

2015-04-12 Thread Stefan Koch via Digitalmars-d-learn
Do have you extern(C) everywhere ?

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
On Sunday, 12 April 2015 at 09:36:54 UTC, Stefan Koch wrote: Do have you extern(C) everywhere ? Yes, at binding file. Here is a lot of string like: extern(C) CPLErr GDALGetGeoTransform( GDALDatasetH, double* );

Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
So I got GDAL binding work. And now I need to understand how to translate C code to D. Here is simple tutorial: http://www.gdal.org/gdal_tutorial.html If I right understand it's easier to take C, than C++ code example. Now I am trying to get very simple example work. My code is: string fi