Andrej Mitrovic:
I didn't know that! Is this documented anywhere?
It's documented formally, but I see no usage examples of the
nested formatting syntax:
http://dlang.org/phobos/std_format.html
Bye,
bearophile
On 3/21/12, Pedro Lacerda wrote:
> dnewbie, you're correct, the return type is void* instead of void.
I didn't notice the pointer thanks to the silly C function pointer syntax. :)
On Tue, Mar 20, 2012 at 10:53 PM, dnewbie wrote:
> On Wednesday, 21 March 2012 at 01:09:58 UTC, Andrej Mitrovic wrote:
>
>> On 3/21/12, Pedro Lacerda wrote:
>>
>>> Ouch, void* is the same in both languages, sorry. I addressed a new
>>> problem:
>>>
>>> typedef struct SomeFunctions {
>>>void
On Wednesday, 21 March 2012 at 01:09:58 UTC, Andrej Mitrovic
wrote:
On 3/21/12, Pedro Lacerda wrote:
Ouch, void* is the same in both languages, sorry. I addressed
a new problem:
typedef struct SomeFunctions {
void *(*funcA)(char*, size_t);
void *(*funcB)(void);
} SomeFunctions;
How d
On 3/21/12, bearophile wrote:
> The following is just a note. The formatting syntax for arrays is
> rather powerful, it allows you to pretty print a matrix.
I didn't know that! Is this documented anywhere?
On 3/21/12, bearophile wrote:
> Are you sure that works?
It's easy to test:
extern(C)
struct SomeFunctions {
void function(char*, size_t) funcA;
void function() funcB;
}
void main()
{
writeln(typeof(SomeFunctions.funcA).stringof);
}
import std.stdio;
void main() {
auto mat = [[1, 2, 3],
[4, 15, 6],
[7, 8, 9]];
writefln("[%([%(%2d, %)],\n %)]]", mat);
}
That outputs:
[[ 1, 2, 3],
[ 4, 15, 6],
[ 7, 8, 9]]
Sorry, the dlang forum online interface has added an extra
leadin
This code:
import std.stdio;
void main() {
auto mat = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]];
writefln("%(%(%d %)\n%)", mat);
writeln();
writefln("[%(%(%d %)\n%)]", mat);
writeln();
writefln("[%([%(%d %)]\n%)]", mat);
writeln();
Andrej Mitrovic:
extern(C)
struct SomeFunctions {
void function(char*, size_t) funcA;
void function() funcB;
}
Are you sure that works?
If that doesn't work then use this and write a bug report:
struct SomeFunctions {
extern(C) void function(char*, size_t) funcA;
extern(C) vo
On 3/21/12, Pedro Lacerda wrote:
> Ouch, void* is the same in both languages, sorry. I addressed a new problem:
>
> typedef struct SomeFunctions {
> void *(*funcA)(char*, size_t);
> void *(*funcB)(void);
> } SomeFunctions;
>
> How do I convert that functions references into an D struct?
e
Ouch, void* is the same in both languages, sorry. I addressed a new problem:
typedef struct SomeFunctions {
void *(*funcA)(char*, size_t);
void *(*funcB)(void);
} SomeFunctions;
How do I convert that functions references into an D struct?
On Tue, Mar 20, 2012 at 3:01 PM, Pedro Lacerda
Hi all,
How to convert the following struct to D?
typedef struct S {
int type;
void *obj;
} S;
I didn't found anything at http://dlang.org/htomodule.html.
On 21 March 2012 04:26, Jay Norwood wrote:
> yes, thanks. I read your other link and that was helpful. I think I
> presumed that the escape handling was something belonging to stdio, while
> regex would have its own valid escapes that would include \p. But I see now
> that the string literals
On 03/20/2012 02:08 AM, Don Clugston wrote:
> For starters, note that ANY integer expression which is exact, is also
> exact in floating point.
With the note that the integer type has better precision at higher
values. For example, there are many 32-bit values that uint can, but
float cannot r
On Tue, Mar 20, 2012 at 02:52:05PM -0700, Ali Çehreli wrote:
[...]
> By the way, is there a name for "the => syntax"?
[...]
You just named it. :-)
T
--
"Real programmers can write assembly code in any language. :-)" -- Larry Wall
On 03/20/2012 10:50 AM, bearophile wrote:
> simendsjo:
>
>> std.array includes a method, array(), for doing exactly this:
>> int[] test2 = array(map!"a+a"(test1)); //eager
>
> With 2.059 you can write that also in a more readable way, because
there is less nesting:
>
> int[] test2 = test1.map!q{
On Tuesday, 20 March 2012 at 04:32:13 UTC, Adam D. Ruppe wrote:
I know very little about std.xml (I looked at it and
said 'meh' and wrote my own lib), but my lib
makes this pretty simple.
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff
grab dom.d and characte
Thanks, very handy!
simendsjo:
> std.array includes a method, array(), for doing exactly this:
> int[] test2 = array(map!"a+a"(test1)); //eager
With 2.059 you can write that also in a more readable way, because there is
less nesting:
int[] test2 = test1.map!q{a + a}().array();
Bye,
bearophile
On Tue, 20 Mar 2012 18:36:46 +0100, ixid wrote:
I understand the point of lazy evaluation but I often want to use the
lazy algorithm library functions in an eager way. Other than looping
through them all which feels rather messy is there a good way of doing
this?
Is there a reason not to
I understand the point of lazy evaluation but I often want to use
the lazy algorithm library functions in an eager way. Other than
looping through them all which feels rather messy is there a good
way of doing this?
Is there a reason not to allow the following to be automatically
treated eage
On Tuesday, 20 March 2012 at 10:28:11 UTC, Dmitry Olshansky wrote:
Note that if your task is to split buffer by exactly '\n' byte
then loop with memchr is about as fast as it gets, no amount of
magic compiler optimizations would make other generic ways
better (even theoretically). What they *co
On 19.03.2012 23:24, Jay Norwood wrote:
On Monday, 19 March 2012 at 13:55:39 UTC, Dmitry Olshansky wrote:
That's right, however counting is completely separate from regex,
you'd want to use std.algorithm count:
count(match(,"\n"));
or more unicode-friendly:
count(match(, regex("$","m"))
On 19/03/12 15:45, H. S. Teoh wrote:
On Mon, Mar 19, 2012 at 08:50:02AM -0400, bearophile wrote:
James Miller:
writeln(v1 == 1); //false
writeln(v1 == 1.0); //false
writeln(v1 == 1.0f); //false
writeln(v1+1 == 2.0f); //true
Maybe I'd like to deprecate a
24 matches
Mail list logo