Re: What's up with GDC?

2016-06-11 Thread Christophe Meessen via Digitalmars-d-learn
Real professionals won't have difficulties to find binaries for ldc: https://github.com/ldc-developers/ldc/releases -- Bien cordialement, Ch.Meessen > Le 10 juin 2016 à 22:30, Joerg Joergonson via Digitalmars-d-learn > a écrit : > >> On Friday, 10 June 2016 at 19:51:19 UTC, Johan Engelen wrot

Re: String compare in words?

2016-05-30 Thread Christophe Meessen via Digitalmars-d-learn
I didn't check assembly for '=='. What I have seen is that struct comparison in dmd is implemented as byte per byte compare even if the struct is 64bit long (e.g. Rebindable). I suppose dmd uses this strategy because struct/array may not be 64bit aligned, or they could have different alignment

Re: Maximum size of an string ?

2013-11-14 Thread Jean Christophe
Than you Ali :0 I assume it is for UTF8 encoding. That's quite large enough. JC On Thursday, 14 November 2013 at 11:50:28 UTC, Ali Çehreli wrote: On 11/14/2013 02:10 AM, Jean Christophe wrote: > Has someone tested the maximum size of a D string variable for both 32 > and 64 bit

Maximum size of an string ?

2013-11-14 Thread Jean Christophe
Hi :) Has someone tested the maximum size of a D string variable for both 32 and 64 bits platforms ? Is it different from the maximum size of a char[] ? Oo` -- JC

Re: fedora libcurl-gnutls issue

2013-11-13 Thread jean christophe
On Friday, 27 September 2013 at 19:44:18 UTC, Joshua Niehus wrote: On Friday, 27 September 2013 at 16:52:49 UTC, Dicebot wrote: Simply building dmd/phobos from git tag should result in proper linkage. Nothing is ever simple with me :) Thanks Dejan and Dicebot +1, build phobos from sources o

Re: std.json

2013-11-13 Thread jean christophe
On Thursday, 17 May 2012 at 18:55:57 UTC, Jarl André wrote: On Thursday, 17 May 2012 at 18:36:22 UTC, Jarl André wrote: On Thursday, 17 May 2012 at 14:08:27 UTC, Vincent wrote: On Sunday, 25 March 2012 at 17:50:45 UTC, Andrea Fontana wrote: Hope it's clear... Nope, it's something like chess

Re: Range of random numbers

2012-04-25 Thread Christophe Travert
;, b[2].to!("seconds",double),"s." ); // outputs : // 0.040437s, 0.0393537s, 0.0486439s } f2 performs 23% better than f3, and 3% better than f1. -- Christophe

Re: Range of random numbers

2012-04-24 Thread Christophe
"bearophile" , dans le message (digitalmars.D.learn:35108), a écrit : > What about (untested): > > auto uniformRange(T1 lower, T2 upper) { > return count().map!(_ => uniform(lower, upper))(); > } That looks like a workarround, not meaningful code. How about return repeat(_ =>uniform(lower

Re: Allow empty field function arguments for default?

2012-04-23 Thread Christophe
(c=5)); // ok fun(fun.c = 5); // ok, but different meaning. } But still, raising an arror is not backward compatible. -- Christophe

Re: Allow empty field function arguments for default?

2012-04-20 Thread Christophe
s not an additive change, while the > OP's suggestion actually is. How about int c; fun(c = 5); ? -- Christophe

Re: Access violation using chain()

2012-04-19 Thread Christophe
"Brad Anderson" , dans le message (digitalmars.D.learn:34902), a écrit : > Perhaps I'm just misunderstanding something about closures but > the following code seems to behave oddly: > > import std.stdio, std.range, std.algorithm, std.string; > > void main() > { > auto lst

Re: Static Associative Arrays

2012-04-12 Thread Christophe
Jonathan M Davis , dans le message (digitalmars.D.learn:34332), a écrit : > On Sunday, April 08, 2012 01:24:02 Caligo wrote: >> On Sat, Apr 7, 2012 at 11:01 PM, Jonathan M Davis > wrote: >> > What do you mean my static associative arrays? Are you asking why you >> > can't >> > initialize a stati

Re: Questions about the slice operator

2012-04-05 Thread Christophe
"Jonathan M Davis" , dans le message (digitalmars.D.learn:34243), a > Except that opSlice already works with "..". What would this buy you? Having a specific range for a .. operator allows you to have them as parameters of any function. For example, this could be nice for multidimensional slicin

Re: writing iterators without code duplication. inout?

2011-12-21 Thread Christophe
"pompei2" , dans le message (digitalmars.D.learn:31164), a écrit : > This is what I have, which works but has severe code duplication. > I hoped inout would help me here, but I just can't figure it out. > I also gave a try to ranges, but same thing again: I can only get > it to work if I define

Re: newbie question: Can D do this?

2011-12-21 Thread Christophe
Timon Gehr , dans le message (digitalmars.D.learn:31142), a écrit : > On 12/20/2011 03:18 PM, clk wrote: >> Thank you for your quick replies. I'm impressed by the helpfulness and >> dedication of the D community! >> Here's another one. Is there a way to pass arguments to functions by >> keyword as

Re: Abstract functions in child classes

2011-12-05 Thread Christophe
With an appropriate (and optional) warning to tell abstract class will soon have to be declared such for several years before there is an (optional) error, and maybe even a patch to make the correction automatically, that should not be such a pain. -- Christophe

Re: How come a thread can access another thread's stack variable?

2011-11-25 Thread Christophe
olation", and it > seems core.thread has the same weaker isolation principle. > > If "foo" is in TLS, how come a new thread can access its members? It could with a cast to shared, couldn't it ? A fix would be to make Thread check the shared-ness of context pointer of the delegate (which may have to be fixed at the compiler level). -- Christophe

Re: Stop TypeTuple as template parameter from expanding

2011-11-04 Thread Christophe
bearophile , dans le message (digitalmars.D.learn:30429), a écrit : > Tobias Pankrath: > >> How would you do this? Do I need an extra template TypeList? > > It's the design of typetuples, they are auto-flattening. I have never > appreciated this design. Maybe Walter likes them this way, or they

Re: std.container & ranges

2011-11-03 Thread Christophe
"Steven Schveighoffer" , dans le message (digitalmars.D.learn:30402), a > The primitive for a container is remove(range). Ranges are essential to > containers, and should be the major interface to them. Programmers have to learn ranges to use containers. Hiding ranges is not helping them. But

Re: An issue with setting delegates via templates

2011-11-02 Thread Christophe Travert
modification of the compiler*, but I am not an expert here. * the compiler should allow all overloads of a function given as a template argument to be tested against the filter to choose the right one, and complain if several overloads match the filter. -- Christophe

Re: std.container & ranges

2011-11-02 Thread Christophe
Kagamin , dans le message (digitalmars.D.learn:30362), a écrit : > Steven Schveighoffer Wrote: > >> ahem, using dcollections: >> >> foreach(ref doRemove, cell; &organism.purge) >> doRemove = cell.x == x && cell.y == y; >> >> complexity: O(n) > > may be a generic iteration handler would be

Re: Implicit cast to immutable

2011-10-27 Thread Christophe
"Steven Schveighoffer" , dans le message (digitalmars.D.learn:30255), a écrit : > On Fri, 21 Oct 2011 11:20:01 -0400, Christophe > wrote: > >> "Daniel Murphy" , dans le message (digitalmars.D.learn:30139), a écrit : >>> "bearophile" wro

Re: An issue with setting delegates via templates

2011-10-27 Thread Christophe
Andrej Mitrovic , dans le message (digitalmars.D.learn:30286), a écrit : > class Foo > { > void func(double) { } > void func(int) { } > > void set(T)(T handler) { dg = handler; } > void delegate(int) dg; > } > > void main() > { > auto foo = new Foo; > foo.set(&foo.func);

Re: FIFO stack

2011-10-27 Thread Christophe
"Nick Sabalausky" , dans le message (digitalmars.D.learn:30309), a écrit : > "Dominic Jones" wrote in message > news:j89arh$2ua3$1...@digitalmars.com... >>> Also an plain array is a good stack. :) >> >> I'd rather not use a plain array because (I assume) that when I push >> or pop using arrays,

Re: scope struct?

2011-10-23 Thread Christophe
Steve Teale , dans le message (digitalmars.D.learn:30117), a écrit : > Is not needed because structs are inherently scope. > > I'm sure experienced D programmers do this all the time when they want > something done on exit from a scope, but I never had, and maybe there are > others who haven't,

Re: Implicit cast to immutable

2011-10-21 Thread Christophe
"Daniel Murphy" , dans le message (digitalmars.D.learn:30139), a écrit : > "bearophile" wrote in message > news:j7jepi$prp$1...@digitalmars.com... >> Daniel Murphy: >> >>> 2) >>> immutable(int[]) fun() { return new int[]; } // conversion happens here >>> immutable x = fun(); >>> >>> Bearophile's

Re: Ranges help

2011-10-14 Thread Christophe
> correct? Or would this be too much? > > isRandomAccessRange && !isFiniteRange && isBidirectionalRange && hasSlicing You should look at: std.algorithm.SetUnion std.algorithm.swapRanges -- Christophe

Re: contrary of std.utf.toUTFz!(const(wchar)*)

2011-10-07 Thread Christophe
Trass3r , dans le message (digitalmars.D.learn:29978), a écrit : >> I feel a little stupid, but how to convert a wchar* zero terminated >> string into a wstring (DMD 2.055)? > > wstring w = cstr[0 .. strlenw(cstr)]; if cstr comes from c code, you cannot guarantee it is immutable. Moreover, cs

Re: contrary of std.utf.toUTFz!(const(wchar)*)

2011-10-07 Thread Christophe
Paolo Invernizzi , dans le message (digitalmars.D.learn:29974), a écrit : > Hi all, > > I feel a little stupid, but how to convert a wchar* zero terminated string > into a wstring (DMD 2.055)? > I'm digging into Phobos, but right now I've found no way... > > Thanks, Paolo. std.conv.to!wstring

Re: Implicit cast to immutable

2011-10-06 Thread Christophe
re functions? > > Right. > > >> I'm only vaguely familiar with pure.. > > I suggest you to use purity more and more in D, because it helps and > with the recent bug fixes it is also becoming usable in D (but there > are some significant problems left, example: map/filter are not pure > yet). You would need to have pure delegates to have a real effect, wouldn't you ? -- Christophe

Re: int C function

2011-09-30 Thread Christophe
cPuts(const char* s) { return puts(s); } and then : x.tt = &cPuts(); By the way, it is not very d-ish to use an "int function(const char*)". we prefer: "int delegate(const char[])". And then: | int cPuts(const char[] s) { return puts(toStringz(s)); } But it depends on what you exactly are trying to do. toStringz can be found in std.string. -- Christophe

Re: Why an abstract pointer cannot be used as value in an associate array?

2011-09-30 Thread Christophe
hancement request to support abstract pointer for the sake of interoperability with C. -- Christophe

Re: Why an abstract pointer cannot be used as value in an associate array?

2011-09-29 Thread Christophe
what is the error message ?

Re: Multithreaded file IO?

2011-09-29 Thread Christophe
Jerry , dans le message (digitalmars.D.learn:29830), a écrit : > trav...@phare.normalesup.org (Christophe) writes: > >> Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit : >>> What I really want is a shared fifo where the input is lines from a >>&g

Re: Using allSatisfy with template that takes multiple type arguments

2011-09-28 Thread Christophe
Andrej Mitrovic , dans le message (digitalmars.D.learn:29825), a écrit : > Thanks for the tips guys. I have another similar issue now, I want to > check whether a type passes any of the predicates I list. This would > be similar to anySatisfy, however anySatisfy takes one predicate and > multiple t

Re: Why is std.string.format a c-style variadic function?

2011-09-27 Thread Christophe
ust me. It seems that the Reference field in Jonathan's posts are unusual and break threads in some news reader. Would anyone know a solution (either for Elley and me, or for Jonathan)? -- Christophe

Re: How to check all values in a range are equal to some predicate?

2011-09-26 Thread Christophe
..$]); } with an appropriate filter if I want to make something nice. -- Christophe

Re: Multithreaded file IO?

2011-09-26 Thread Christophe
Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit : > Lutger Blijdestijn Wrote: > >> If you didn't know, the concurrency chapter of tdpl is a free chapter: >> http://www.informit.com/articles/article.aspx?p=1609144 >> >> It has an example of file copying with message passing: >

Re: Wrong const attribute?

2011-09-23 Thread Christophe
ent, Bar.i cannot be immutable. If you really want Bar.i to be immutable, Foo must hold a pointer to Bar, so you can change this pointer, or Bar can be a class instead of a struct (which means Foo does contain a pointer to Bar, but you don't have to notice it). -- Christophe Travert

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Christophe Travert
!= 0); return n; } Let's see how we can boost std.utf.stride that way... -- Christophe

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Christophe
uld cost much more, which may not be desirable, so why bother checking at all? A more serious benchmark could justify to change std.utf.stride. The improvement could be even better in real situation, because the lookup table of utfLikeStride may not be always at hand - this actually really depends on what the compiler does. In any case, this may not improve walkLength by more than a few percents. -- Christophe now I'll go back to my real work...

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-20 Thread Christophe
e an enhancement request. It would > make the functionality different enough to prevent count from being > removed: walkLength throws on an invalid UTF sequence. I would be glad to do so, but I am quite new here, so I don't know how to. A little pointer could help. -- Christophe

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-20 Thread Christophe
"Jonathan M Davis" , dans le message (digitalmars.D.learn:29637), a écrit : > On Tuesday, September 20, 2011 14:43 Andrej Mitrovic wrote: >> On 9/20/11, Jonathan M Davis wrote: >> > Or std.range.walkLength. I don't know why we really have std.utf.count. I >> > just >> > calls walkLength anyway. I

Re: Dynamic Array Question

2011-09-20 Thread Christophe
> To avoid having to change your other code, I'd do this: > > wchar[] t = ...; > scope(exit) delete t; // add this line to the end of the function (after > returning) > > There is another way, but it's not as easy: > > // put this at the top of file > import core.memory; > > ... > > scope(ex

Re: const->immutable array argument?

2011-09-20 Thread Christophe
bearophile , dans le message (digitalmars.D.learn:29609), a écrit : > what's wrong in this code? > > > void foo(const ref int[5] a) {} > void main() { > immutable int[5] arr; > foo(arr); // Error? > } I don't think it is wrong. Did you try changind the order of const and ref, or adding

Re: Why can't templates with default arguments be instantiated without the bang syntax?

2011-09-15 Thread Christophe
used to mixin enough. Can you mixin normal templates, and not only mixin templates ? Anyway, why would this mixin Bar ? As I understand the proposition, only "mixin Baz!(Foo.Bar);" and of course "mixin Baz!(Foo!().Bar)" should mixin Bar. -- Christophe

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-15 Thread Christophe
gt; test.d(10): Error: switch case fallthrough - use 'goto default;' if intended If there is a goto aLabel somewhere, the program could go to line 9. Then it should fall to the default statement, but the compiler asks for an explicit fallthrough, since default is not a simple label, but something like a case statement. -- Christophe

Re: A question about purity

2011-09-13 Thread Christophe
bearophile , dans le message (digitalmars.D.learn:29490), a écrit : > Jonathan M Davis: > >> However, Foo.y is not encapsulated >> by a strongly pure function at all. Other functions can alter alter it. So, >> it >> breaks purity. > > Thank you for your explanation :-) > > So, let's change th

Re: package access specifier not usable within a class

2011-09-09 Thread Christophe
Christophe, dans le message (digitalmars.D.learn:29394), a écrit : > Andrej Mitrovic , dans le message (digitalmars.D.learn:29388), a écrit : >> abstract class Foo >> { >> package void test(); >> } >> >> class Bar : Foo >> { >> ov

Re: package access specifier not usable within a class

2011-09-09 Thread Christophe
st solution IMO. It's not a huge problem if private methods cannot be virtual, if you can make them package virtual. In the meantime, I would make the method public, but prefix the name with an underscore to indicate it is morally private. I agree that it is relying on the client's good will. -- Christophe

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Christophe
Justin Whear , dans le message (digitalmars.D.learn:29380), a écrit : > That'll work if you don't mind normal output being mixed with error > messages. > > > Timon Gehr wrote: > >> On 09/08/2011 07:26 PM, Justin Whear wrote: >>> The Posix solution is to use pipes. Basically, you'll want the par

Re: About static variables

2011-09-05 Thread Christophe
Nothing worth adding a confusing semantic to the langage. Just prefix your variable's name. Nobody will want to use myFunctionPrivateVariable outside of myFunction: class Foo { private size_t myFunctionPrivateCount; void myFunction() { alias myFunctionPrivateCount count; // ..

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Christophe
Try to create the method: const void toString(void delegate(const(char)[]) sink, string formatString) { sink(toString()); }

Re: Create a foreach-able struct? Multi-dimensional even?

2011-08-25 Thread Christophe
> Still, is the multi-dimensional part possible? Sure, you have to make an opApply that takes several parameters in its delegate. An exemple: struct TwoDArray(int nx, int ny) { int[nx][ny] data; int opApply(int delegate(ref int i, ref int j, ref int cell) { foreach (i; 0..nx)

Re: reading in text files

2011-08-24 Thread Christophe
> The default stdin doesn't have an end, and unless you type something > in, there's no input at all. That's why the program just hangs. You can end keyboard stdin by typing ^D (Ctrl + D) under unix.