Re: Help, what is the code mean?

2020-04-28 Thread ag0aep6g via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 20:48:57 UTC, Net wrote: () { ... } (); Is there a name of this kind of function in D? unnamed? anonymous? The spec uses "anonymous". Syntactically, `() { ... }` is a function literal. There is a section called "Anonymous Functions and Anonymous Delegates" [1]

Re: Help, what is the code mean?

2020-04-28 Thread Ali Çehreli via Digitalmars-d-learn
On 4/28/20 1:48 PM, Net wrote: > () { ... } (); > > Is there a name of this kind of function in D? unnamed? anonymous? Lambda or anonymous function.[1] Note that the last () is not part of the definition but the execution of the function. This idiom is used for initializing e.g. a const varia

Re: Help, what is the code mean?

2020-04-28 Thread Net via Digitalmars-d-learn
On Monday, 27 April 2020 at 13:36:25 UTC, Adam D. Ruppe wrote: On Monday, 27 April 2020 at 13:29:08 UTC, lilijreey wrote: Hi: In dlang core.thread.osthread has below code, the 654 line code i can understand why write () first, and {m_fn = fn;}() do what? The stdlib uses that pattern from

Re: Is the behaviour of shift expressions with negative left operands defined / portable?

2020-04-28 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Apr 28, 2020 at 08:30:27PM +, Harry Gillanders via Digitalmars-d-learn wrote: > The spec doesn't seem to explicitly mention what happens when the left > operand of a shift expression is signed and negative. [1] > But I know that D follows C's semantics for this sort of stuff, and > the

Is the behaviour of shift expressions with negative left operands defined / portable?

2020-04-28 Thread Harry Gillanders via Digitalmars-d-learn
The spec doesn't seem to explicitly mention what happens when the left operand of a shift expression is signed and negative. [1] But I know that D follows C's semantics for this sort of stuff, and the C standard specifies that the result of a negative left operand is undefined for `<<`, and im

Re: Building Win32 application via dub

2020-04-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 19:25:06 UTC, Sam E. wrote: I'm a bit surprised to see a linking error given that building directly from `dmd` seems to work fine without any flag. dmd directly uses -m32 whereas dub by default uses -m32mscoff to dmd. The mscoff linker (also used for -m64 btw) do

Re: GtkD - how to list 0..100K strings

2020-04-28 Thread mark via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 18:46:18 UTC, Kagamin wrote: Try this: void populate(NameAndDescription[] namesAndDescriptions) { if(namesAndDescriptions.length>100)namesAndDescriptions=namesAndDescriptions[0..100]; innerView.viewData.populate(namesAndDescriptions); } I

Building Win32 application via dub

2020-04-28 Thread Sam E. via Digitalmars-d-learn
Hi, I'm fairly new to D, just playing around with Win32 bindings. I have a Win32 hello world that works when build via `dmd .\source\app test-win32.def`. I'm now trying to build the application via `dub`, but I cannot find what configuration I would need to do so. By default, just running `

Re: Help, what is the code mean?

2020-04-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 27, 2020 9:52:32 AM MDT drug via Digitalmars-d-learn wrote: > 27.04.2020 18:28, data pulverizer пишет: > > I'm probably not the first person to say this but. Isn't @trusted an odd > > label to give unsafe functions and open to abuse by unscrupulous > > programmers? It almost says "

Re: GtkD - how to list 0..100K strings [solved]

2020-04-28 Thread Kagamin via Digitalmars-d-learn
On Monday, 27 April 2020 at 10:28:04 UTC, mark wrote: I renamed the class shown in my previous post from View to InnerView, then created a new View class: class View : ScrolledWindow { import qtrac.debfind.modelutil: NameAndDescription; InnerView innerView; this() { super(

Re: GtkD crash: 'BadAlloc (insufficient resources for operation)'

2020-04-28 Thread Cogitri via Digitalmars-d-learn
On Monday, 27 April 2020 at 14:53:06 UTC, mark wrote: Below is the bt. Does it look like my bug or a Gtk or GtkD bug? That's hard to say without the debug info for gtkd, gtk and glib installed (so the backtrace isn't all the useful), but since gtkd isn't mentioned in the log I guess that it's

Re: Dub failing with message about DFLAGS

2020-04-28 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2020-04-28 at 15:09 +, WebFreak001 via Digitalmars-d-learn wrote: > […] > > well it was some problem that you tried to use the $DFLAGS > environment variable somewhere but it wasn't defined The problem is something to do with Dub and Unit-Threaded. My build never uses the "$DFLAGS" e

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 14:26:11 UTC, Russel Winder wrote: On Tue, 2020-04-28 at 14:03 +, WebFreak001 via Digitalmars-d-learn wrote: […] in this case, try dub upgrade --vverbose and the full exception message should hopefully show I have no idea what has changed, but things are now

Re: Dub failing with message about DFLAGS

2020-04-28 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2020-04-28 at 14:03 +, WebFreak001 via Digitalmars-d-learn wrote: > […] > > in this case, try dub upgrade --vverbose and the full exception > message should hopefully show I have no idea what has changed, but things are now working again. Strange. Thanks for chipping in with support

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 13:44:14 UTC, Russel Winder wrote: On Tue, 2020-04-28 at 12:04 +, WebFreak001 via Digitalmars-d-learn wrote: [...] I am not sure this gives any further information. :-( [...] in this case, try dub upgrade --vverbose and the full exception message should hop

Re: Dub failing with message about DFLAGS

2020-04-28 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2020-04-28 at 12:04 +, WebFreak001 via Digitalmars-d-learn wrote: > On Tuesday, 28 April 2020 at 11:56:26 UTC, Russel Winder wrote: > > Hi, > > > > Has anyone seen this before, it has just started happening to > > me and is stopping me doing any work on this D project. > > > > > > >

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 11:56:26 UTC, Russel Winder wrote: Hi, Has anyone seen this before, it has just started happening to me and is stopping me doing any work on this D project. |> dub build Invalid variable: DFLAGS try running with `dub build -v`

Dub failing with message about DFLAGS

2020-04-28 Thread Russel Winder via Digitalmars-d-learn
Hi, Has anyone seen this before, it has just started happening to me and is stopping me doing any work on this D project. |> dub build Invalid variable: DFLAGS -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 46