Re: Crosscompile to Windows

2021-11-08 Thread Luis via Digitalmars-d-learn
On Monday, 8 November 2021 at 01:16:25 UTC, rikki cattermole wrote: On 08/11/2021 11:34 AM, Imperatorn wrote: On Sunday, 7 November 2021 at 22:19:08 UTC, russhy wrote: If i remember correctly, all you have to do is:     dub build --arch=x86_64-pc-windows-msvc --compiler=ldc2 Is this

Re: Crosscompile to Windows

2021-11-05 Thread Luis via Digitalmars-d-learn
On Friday, 5 November 2021 at 18:13:03 UTC, Imperatorn wrote: On Friday, 5 November 2021 at 18:11:35 UTC, Luis wrote: There is a obvious way to crosscompile a dub project to Windows from a Linux dev machine ? Wine  Ideally should be something like `dub build -target=x64-windows` or

Crosscompile to Windows

2021-11-05 Thread Luis via Digitalmars-d-learn
There is a obvious way to crosscompile a dub project to Windows from a Linux dev machine ?

Re: anonymous functions and scope(exit)

2021-07-04 Thread Luis via Digitalmars-d-learn
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote: On Sunday, 4 July 2021 at 08:24:36 UTC, Luis wrote: Dennis's explanation makes the most sense: writeln can throw an Exception, so its presence prevents nothrow inference, which otherwise permits the (not intended to be catchable)

Re: anonymous functions and scope(exit)

2021-07-04 Thread Luis via Digitalmars-d-learn
On Saturday, 3 July 2021 at 22:52:39 UTC, frame wrote: On Saturday, 3 July 2021 at 22:04:04 UTC, Luis wrote: scope(exit) it's syntactic sugar for a classic `try {} finally {}` . The documentation says that must be executed. It works if you replace printf() with writeln() or use writeln()

Re: anonymous functions and scope(exit)

2021-07-03 Thread Luis via Digitalmars-d-learn
On Saturday, 3 July 2021 at 20:46:00 UTC, Steven Schveighoffer wrote: On 7/3/21 4:08 PM, frame wrote: On Saturday, 3 July 2021 at 17:39:18 UTC, Steven Schveighoffer wrote: But in practice, the compiler does not have to clean up anything when an `Error` is thrown. Whether it does or not is

Re: anonymous functions and scope(exit)

2021-07-03 Thread Luis via Digitalmars-d-learn
On Saturday, 3 July 2021 at 17:47:47 UTC, Dennis wrote: On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote: scope(exit) inside of a anonymous functions, it's never called. I think the compiler infers the function `nothrow` since you don't throw any `Exception`, only an `Error`. Errors

anonymous functions and scope(exit)

2021-07-03 Thread Luis via Digitalmars-d-learn
This is intentional ? ``` should(function void() { auto emptyStack = SimpleStack!int(); scope(exit) emptyStack.free; // <= This is never called emptyStack.reserve(16); emptyStack.top; }).Throw!RangeError; ``` scope(exit) inside

Re: unit test that show more than one failure

2020-06-16 Thread Luis via Digitalmars-d-learn
On Tuesday, 16 June 2020 at 06:19:51 UTC, Joel wrote: I've tired different unit test libraries, but they jump out on errors instead of just adding to failed numbers. I'm thinking like this: ``` @("dummy"); unittset { 0.shouldEqual(0); 1.shouldEqual(2); 2.shouldEqual(3); } ``` Test:

Re: Finding the file and unittest that triggers an ICE during dub project build only when unittests are enabled

2020-06-12 Thread Luis via Digitalmars-d-learn
On Friday, 12 June 2020 at 18:18:25 UTC, Per Nordlöw wrote: When I build my project as dub run --compiler=dmd --build=unittest it crashes as Performing "unittest" build using dmd for x86_64. phobos-next ~master: building configuration "library"... Segmentation fault (core dumped) dmd

Re: How debugg unittest with visual code + code-d

2020-06-06 Thread Luis via Digitalmars-d-learn
On Saturday, 6 June 2020 at 08:42:22 UTC, WebFreak001 wrote: On Saturday, 6 June 2020 at 08:06:02 UTC, Luis wrote: On Friday, 5 June 2020 at 18:13:52 UTC, WebFreak001 wrote: [...] It isn't working correctly on my case : I get this error : Performing "unittest" build using dmd for x86_64.

Re: How debugg unittest with visual code + code-d

2020-06-06 Thread Luis via Digitalmars-d-learn
On Friday, 5 June 2020 at 18:13:52 UTC, WebFreak001 wrote: To build before running the debugger, add the following task to your task definitions file (Ctrl-Shift-B): { "label": "dub build", // <-- add a good name here "type": "dub", "run": false, "buildType":

How debugg unittest with visual code + code-d

2020-06-05 Thread Luis via Digitalmars-d-learn
So I actually managed to "debug" my unittests but It requires that I run previsuly "dub test" on console, so the executable is update. As I understand, I need to setup a task to be prelaunched by debug to generate the unittest executable, but I don't know how setup it correctly. I only manage

Re: What's the best way to find out which exceptions may be thrown ?

2020-06-03 Thread Luis via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: Could you please elaborate why checked exceptions are more annoying? Have like 3 functions : A calls B, B calls C . Imagine that now you need to throw a checked exception on C, that before wasn't necessary. You need to add the

Re: How to efficiently resolve Associative Arrays not being sorted?

2020-06-02 Thread Luis via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 07:32:56 UTC, BoQsc wrote: I want to read a file, put it into an array, make some search and replace on the content and output the modified text. However Associative Arrays seem to be unsorted by default. Should I drop the Associative Arrays and use something else?

Re: Logging best practices

2020-05-31 Thread Luis via Digitalmars-d-learn
On Sunday, 31 May 2020 at 20:04:11 UTC, mw wrote: Thanks. For the colored console logger, I'm using this one: https://code.dlang.org/packages/colored-logger so far so good. (I prefer to use library, instead of reinvent my own wheels :-). I dind't know that exists. 

Re: Logging best practices

2020-05-31 Thread Luis via Digitalmars-d-learn
On Saturday, 30 May 2020 at 18:17:21 UTC, mw wrote: A related question: how to log to multiple destinations? e.g. both console & log file? any examples? Thanks. ```D auto multiLogger = new MultiLogger(); multiLogger.insertLogger("console", new FileLogger(stdout, LogLevel.all));

opEquals @safe is ignored

2020-05-24 Thread Luis via Digitalmars-d-learn
Lets take this example code (https://run.dlang.io/is/Vkpx9j) : ´´´D import std; void main() { } class ExampleC { int x; this (int x) @safe { this.x = x; } override bool opEquals(Object o) const @trusted { if (ExampleC rhs = cast(ExampleC)o) { return this.x == rhs.x;

Re: Storing a reference to the calling object

2020-05-23 Thread Luis via Digitalmars-d-learn
On Saturday, 23 May 2020 at 09:27:46 UTC, Tim wrote: Hi all, I'm a little new to D and I'm wondering how I can store a reference to the calling object. I want to create a reference to an object's parent so that each time I go to update the sprite, it is able to grab its position from the

Why emsi containers have @disabled this(this) ?

2020-05-19 Thread Luis via Digitalmars-d-learn
So, I'm writing my own implementation of sparse sets, and I take as reference emsi_containers for allocator usage. I saw that they have disabled postblit operator... But i don't understand exactly why. In special, when they implement InputRange over the containers, but having disabled

Re: D, Unit_Threaded, and GtkD

2020-05-17 Thread Luis via Digitalmars-d-learn
On Sunday, 17 May 2020 at 10:19:38 UTC, Russel Winder wrote: I am experimenting with using manual control of the Glib event loop using the pending and iteration methods on the default MainContext within each unit- threaded test. The alternative of running a GTK application and then putting the

DUB Registry

2020-05-15 Thread Luis via Digitalmars-d-learn
There is a way to make to ignore some branchs and tags? Actually it's pretty annoying when someone publish a fork, and spams with "does not match the original package name" on older tags.

Re: Optional type parameter on a template

2020-05-12 Thread Luis via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 20:40:35 UTC, Adam D. Ruppe wrote: A default argument of void is a common way to do it template foo(T = void) { static if(is(T == void)) { not given } else { use T } } Perfect! Works as I desired.

Optional type parameter on a template

2020-05-12 Thread Luis via Digitalmars-d-learn
I'm trying to make a SparseSet that on function of a optional type parameter, could alongside the index set, store other data. So I need a way to declare a optional type template parameter. I prototyped this stuff on run.dlang, but I like know if there is a better way :

Re: Optional type parameter on a template

2020-05-12 Thread Luis via Digitalmars-d-learn
Sorry ... wrong link. This is the correct : https://run.dlang.io/is/D2iCP0

Re: Integration tests

2020-05-11 Thread Luis via Digitalmars-d-learn
On Wednesday, 22 April 2020 at 10:32:48 UTC, Russel Winder wrote: I ended up creating the following project structure: . ├── dub.sdl ├── dub.selections.json ├── source │ ├── arcam_protocol.d │ └── main.d ├── tests │ └── integration_tests.d └── test_support └── mock_avr850 └──

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread Luis via Digitalmars-d-learn
On Thursday, 29 June 2017 at 12:00:53 UTC, Simon Bürger wrote: Thanks a lot for your comments. On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: [...] This is only happening on CTFE ? Enforcing to use the old 8086 FPU for any float/double operation would give a lot performance

Re: Speed up `dub`.

2016-03-08 Thread Luis via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 15:43:28 UTC, rcorre wrote: On Monday, 7 March 2016 at 22:47:13 UTC, Luis wrote: I try to grab dstep with dub fetch step (dub version 0.9.24, built on Aug 19 2015, on Ubuntu), and try to run dub build step. I can confirm that on my machine takes around 5 seconds

Re: Speed up `dub`.

2016-03-07 Thread Luis via Digitalmars-d-learn
On Monday, 7 March 2016 at 18:58:55 UTC, ciechowoj wrote: dub --version DUB version 0.9.24+161-gb9ce700, built on Feb 23 2016 `dub.json` is `dub.json` of dstep `dub test --skip-registry=all` Do not helps. I try to grab dstep with dub fetch step (dub version 0.9.24, built on Aug 19 2015, on

Re: Speed up `dub`.

2016-03-07 Thread Luis via Digitalmars-d-learn
On Monday, 7 March 2016 at 09:18:37 UTC, ciechowoj wrote: I'm using `dub` to build project. And every time I run `dub` it seems to check if dependencies are up to date, which takes some time. Is there a way to switch of that checking? Or any other way to speed up building process? It really

Re: Formatting a string on a variadic parameter function without using GC

2016-03-02 Thread Luis via Digitalmars-d-learn
On Wednesday, 2 March 2016 at 04:12:13 UTC, Mike Parker wrote: On Wednesday, 2 March 2016 at 01:39:13 UTC, David G. Maziero wrote: Consider the following function: void RenderText( FontBMP font, int x, int y, const char* text ) { for( int r=0; text[r]!='\0'; ++r ) {

Re: How to better organize dub project to get 3 exe from same codebase?

2016-02-25 Thread Luis via Digitalmars-d-learn
On Thursday, 25 February 2016 at 20:55:33 UTC, Suliman wrote: On Thursday, 25 February 2016 at 19:09:59 UTC, Suliman wrote: Where to store shared classes? { "name": "123", "authors": [ "Suliman" ], "description": "A minimal D application.",

Re: Dynamic pitch shift

2016-02-25 Thread Luis via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 11:17:27 UTC, Tanel Tagaväli wrote: Sorry for the confusing state of the codebase. Only the saw wave generator is currently functional, the `saw` and `sine` functions are not used and should be left out of analysis. Also, audio output is only to ALSA. Be

Re: Why this code can't take advantage from CTFE?

2016-02-05 Thread Luis via Digitalmars-d-learn
On Friday, 5 February 2016 at 09:36:37 UTC, Andrea Fontana wrote: On Wednesday, 3 February 2016 at 22:45:47 UTC, Timon Gehr wrote: I would use enum forceCTFE(alias expr)=expr; though. With alias it won't force compile-time evaluation of expressions that can be interpreted as symbols. I've a

Re: DUB, Platform specifications and dependencies

2016-01-22 Thread Luis via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:27:51 UTC, Zardoz wrote: On Monday, 30 November 2015 at 16:54:43 UTC, Sönke Ludwig wrote: Am 24.11.2015 um 19:51 schrieb Zardoz: Platform specifications are currently not supported for dependencies due to the way the dependency resolver works. However, it is

Re: why the sort result is different with C#

2016-01-22 Thread Luis via Digitalmars-d-learn
On Friday, 22 January 2016 at 06:53:29 UTC, mzf wrote: D code: auto arr = ["b1=1", "b=2","a1=1", "a=2"]; writeln(arr.sort()); output:["a1=1", "a=2", "b1=1", "b=2"] C# code: var arr = new string[]{ "b1=1", "b=2", "a1=1", "a=2" }; Array.Sort(arr); output:["a=2","a1=1","b=2","b1=1"] I

Re: cairo(D) / x64 / unresolved externals / don't know why

2016-01-11 Thread Luis via Digitalmars-d-learn
On Monday, 11 January 2016 at 06:53:51 UTC, Benjamin Thaut wrote: Out of curiosity, why do you pass "-m64" 6 times to dmd? Once would be enough. I saw VisualD (dub generated project file) doing that with the latest version of Visual Studio comunnity, when I change to 64 bit building.

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-11 Thread Luis via Digitalmars-d-learn
On Sunday, 10 January 2016 at 06:35:34 UTC, rsw0x wrote: On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote: Just translating some simple C++/glm/opengl tutorial code to D/gl3n/opengl and I'm coming across more friction than I expected. I've got a square centered at my window

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-11 Thread Luis via Digitalmars-d-learn
On Monday, 11 January 2016 at 10:04:29 UTC, Luis wrote: On Sunday, 10 January 2016 at 06:35:34 UTC, rsw0x wrote: On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote: Just translating some simple C++/glm/opengl tutorial code to D/gl3n/opengl and I'm coming across more friction than

Re: CMake support for D

2016-01-04 Thread Luis via Digitalmars-d-learn
On Sunday, 3 January 2016 at 17:30:15 UTC, Dibyendu Majumdar wrote: Does CMake recognise D in the enable_language command? If not is there a workaround? Thanks and Regards Dibyendu I suggest use dub instead of cmake. I did a try to use cmake some time ago (a few years ago, before dub), and

Re: Threading to prevent GUI Freeze

2016-01-04 Thread Luis via Digitalmars-d-learn
On Monday, 4 January 2016 at 14:31:04 UTC, TheDGuy wrote: Hello, i use GTKD to draw some stuff on a DrawingArea. Because it needs some time to calculate i want to outsource those calculation so that the GUI doesn't freeze. I tried it with "std.concurrency" like this: bool

Re: Set color to a single point in Cairo

2015-12-22 Thread Luis via Digitalmars-d-learn
On Sunday, 20 December 2015 at 01:17:50 UTC, Basile B. wrote: On Saturday, 19 December 2015 at 14:16:23 UTC, TheDGuy wrote: is it possible to set the color of a single pixel with Cairo? Not like you would do with a classic canvas (2d grid), because colors are applied with `cairo_fill()` and

Re: optlink windows warning 178

2015-11-26 Thread Luis via Digitalmars-d-learn
On Thursday, 26 November 2015 at 11:00:28 UTC, SpacenJasset wrote: Hello, I am trying to build against the version 3.2.1 of gtk bindings in the dub repository. The build system has built the gtkd-3.lib library file, but doesn't not appear to want to link it to anything else. It gets stuck