Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 16:11:17 UTC, Guillaume Piolat wrote: On Thursday, 8 July 2021 at 14:09:30 UTC, drug wrote: 08.07.2021 16:51, Виталий Фадеев пишет: Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL,

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 16:32:44 UTC, drug wrote: 08.07.2021 19:11, Виталий Фадеев пишет: I fix source code, as drug say. I've fixed the issue upstream, shortly gfm7 v1.1.2 will be available. Drug, thank! I using!

Re: Error: Outside Unicode code space

2021-07-08 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 9 July 2021 at 03:09:52 UTC, Tony wrote: The editor I am using (Code::Blocks) displays the characters just fine. So it seems that the error message should be "Error: Outside the ASCII code space". D supports stuff outside the ASCII code space just fine. Are you sure the file is

Error: Outside Unicode code space

2021-07-08 Thread Tony via Digitalmars-d-learn
I copied some text from a web page into a comment and I get the error "Error: Outside Unicode code space". This appears to be an incorrect error message. It is upset about double quotes that lean forward or backwards, and apostrophes that lean backwards. And dashes that aren't the keyboard

Re: how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 9 July 2021 at 01:51:55 UTC, dangbinghoo wrote: On Thursday, 8 July 2021 at 11:18:26 UTC, russhy wrote: On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and

Re: how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:18:26 UTC, russhy wrote: On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated`

Re: UFCS doubt

2021-07-08 Thread Dennis via Digitalmars-d-learn
On Thursday, 8 July 2021 at 23:31:57 UTC, Antonio wrote: "It works as described in the manual, not as expected" (from MySQL haters club :-p) . Yeah, 50/285 people answering the question "What language features do you miss?" chose "UFCS for local symbols" in the [State of D survey

Re: UFCS doubt

2021-07-08 Thread Antonio via Digitalmars-d-learn
On Thursday, 8 July 2021 at 22:31:49 UTC, Dennis wrote: On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote: I supossed that ```mfp(c,20)``` and ```c.mfp(20)``` should be equivalent because UFCS in second example, but it is not... why? UFCS does not work for nested functions. Functions

Re: UFCS doubt

2021-07-08 Thread jfondren via Digitalmars-d-learn
On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote: onlineapp.d(9): Error: no property `mfp` for type `onlineapp.C` I supossed that ```mfp(c,20)``` and ```c.mfp(20)``` should be equivalent because UFCS in second example, but it is not... why?

Re: UFCS doubt

2021-07-08 Thread Dennis via Digitalmars-d-learn
On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote: I supossed that ```mfp(c,20)``` and ```c.mfp(20)``` should be equivalent because UFCS in second example, but it is not... why? UFCS does not work for nested functions. Functions declared in a local scope are not found when searching

Re: UFCS doubt

2021-07-08 Thread Adam Ruppe via Digitalmars-d-learn
On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote: I supossed that ```mfp(c,20)``` and ```c.mfp(20)``` should be equivalent because UFCS in second example, but it is not... why? UFCS only works with functions defined at top level, not nested inside other functions. That's just how it

UFCS doubt

2021-07-08 Thread Antonio via Digitalmars-d-learn
In this example (extracted from https://digitalmars.com/articles/b68.html), this works: ``` class C { int a; int foo(int i) { return i + a; } } auto mfp = (C self, int i)=>self.foo(i); void main(){ auto c = new C; assert( c.mfp(20)==20); } ``` but this fails ``` class C { int a;

Re: assert(false) and GC

2021-07-08 Thread jmh530 via Digitalmars-d-learn
On Thursday, 8 July 2021 at 18:11:50 UTC, DLearner wrote: Hi Please confirm that: ` assert(false, __FUNCTION__ ~ "This is an error message"); ` Will _not_ trigger GC issues, as the text is entirely known at compile time. Best regards Consider below. Only z will generate an error. This

assert(false) and GC

2021-07-08 Thread DLearner via Digitalmars-d-learn
Hi Please confirm that: ` assert(false, __FUNCTION__ ~ "This is an error message"); ` Will _not_ trigger GC issues, as the text is entirely known at compile time. Best regards

Re: Trivial simple OpenGl working example

2021-07-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote: Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL, GLFW, Derelict, etc. Can you help me ? this one of mine [1] was very simple in the beginning. It

Re: Trivial simple OpenGl working example

2021-07-08 Thread drug via Digitalmars-d-learn
08.07.2021 19:11, Виталий Фадеев пишет: I fix source code, as drug say. I've fixed the issue upstream, shortly gfm7 v1.1.2 will be available.

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-07-08 Thread bauss via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 16:41:40 UTC, someone wrote: On Wednesday, 30 June 2021 at 16:24:38 UTC, Andre Pany wrote: Side note: in case you want to work with money, you may consider using a specific data type like https://code.dlang.org/packages/money instead of float/double. Yes, I've

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 16:01:37 UTC, Dennis wrote: On Thursday, 8 July 2021 at 14:20:16 UTC, Виталий Фадеев wrote: Has dub flag for disable "warnings are treated as errors" ? You have to edit the package file to include `buildRequirements "allowWarnings"`, see

Re: Trivial simple OpenGl working example

2021-07-08 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 8 July 2021 at 14:09:30 UTC, drug wrote: 08.07.2021 16:51, Виталий Фадеев пишет: Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL, GLFW, Derelict, etc. Can you help me ?

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-07-08 Thread bauss via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 16:19:35 UTC, someone wrote: On Wednesday, 30 June 2021 at 10:38:05 UTC, jmh530 wrote: You've never given something away for free? ... more often than usual LoL Now, seriously, something for free has not a price = 0, it has NO price, that's what null is for;

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 15:57:53 UTC, drug wrote: 08.07.2021 18:46, Виталий Фадеев пишет: On Thursday, 8 July 2021 at 15:30:07 UTC, drug wrote: 08.07.2021 17:20, Виталий Фадеев пишет: [...] I failed to reproduce that. What platform you use and what is the compiler version? drug,

Re: Trivial simple OpenGl working example

2021-07-08 Thread drug via Digitalmars-d-learn
08.07.2021 18:46, Виталий Фадеев пишет: On Thursday, 8 July 2021 at 15:30:07 UTC, drug wrote: 08.07.2021 17:20, Виталий Фадеев пишет: [...] I failed to reproduce that. What platform you use and what is the compiler version? drug, Linux, Ubuntu, x64 # uname -a Linux unknown

Re: Trivial simple OpenGl working example

2021-07-08 Thread Dennis via Digitalmars-d-learn
On Thursday, 8 July 2021 at 14:20:16 UTC, Виталий Фадеев wrote: Has dub flag for disable "warnings are treated as errors" ? You have to edit the package file to include `buildRequirements "allowWarnings"`, see https://dub.pm/package-format-sdl.html#build-requirements

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 15:30:07 UTC, drug wrote: 08.07.2021 17:20, Виталий Фадеев пишет: [...] I failed to reproduce that. What platform you use and what is the compiler version? drug, Linux, Ubuntu, x64 # uname -a Linux unknown 5.11.0-22-generic #23-Ubuntu SMP Thu Jun 17 00:34:23

Re: Trivial simple OpenGl working example

2021-07-08 Thread drug via Digitalmars-d-learn
08.07.2021 17:20, Виталий Фадеев пишет: vital@unknown:~/src/dtest/working-example/gfm7/examples/simpleshader$ dub run Fetching bindbc-opengl 0.15.0 (getting selected version)... Fetching colorize 1.0.5 (getting selected version)... Fetching gfm 8.0.6 (getting selected version)... Fetching

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 14:20:25 UTC, Adam D Ruppe wrote: On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote: It may be based on any library: SDL, GLFW, Derelict, etc. my library http://arsd-official.dpldocs.info/arsd.simpledisplay.html#topic-modern-opengl

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 14:09:38 UTC, Dennis wrote: On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote: I searching trivial simple D/OpenGL working in 2021 year example. https://github.com/dkorpel/glfw-d/tree/master/examples/triangle-gl Uses bindbc-opengl + glfw-d (my

Re: Trivial simple OpenGl working example

2021-07-08 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote: It may be based on any library: SDL, GLFW, Derelict, etc. my library http://arsd-official.dpldocs.info/arsd.simpledisplay.html#topic-modern-opengl arsd-official:simpledisplay dependency on dub, or just download color.d and

Re: Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
On Thursday, 8 July 2021 at 14:09:30 UTC, drug wrote: 08.07.2021 16:51, Виталий Фадеев пишет: Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL, GLFW, Derelict, etc. Can you help me ?

Re: Trivial simple OpenGl working example

2021-07-08 Thread Dennis via Digitalmars-d-learn
On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote: I searching trivial simple D/OpenGL working in 2021 year example. https://github.com/dkorpel/glfw-d/tree/master/examples/triangle-gl Uses bindbc-opengl + glfw-d (my package), example uses OpenGL 3.3. Should works on Windows and

Re: Trivial simple OpenGl working example

2021-07-08 Thread drug via Digitalmars-d-learn
08.07.2021 16:51, Виталий Фадеев пишет: Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL, GLFW, Derelict, etc. Can you help me ? https://github.com/drug007/gfm7/tree/master/examples/simpleshader it's not trivial

Trivial simple OpenGl working example

2021-07-08 Thread Виталий Фадеев via Digitalmars-d-learn
Hi! I searching trivial simple D/OpenGL working in 2021 year example. It may be triangle. It may be based on any library: SDL, GLFW, Derelict, etc. Can you help me ?

Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
On Thursday, 8 July 2021 at 12:04:01 UTC, Paul Backus wrote: https://digitalmars.com/articles/b68.html Thank you very much :D

Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:53:42 UTC, Tejas wrote: Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto

Re: What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:53:42 UTC, Tejas wrote: Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto

What is the D equivalent of C++'s method pointers?

2021-07-08 Thread Tejas via Digitalmars-d-learn
Given a class ```Employee``` , if I have the following code ``` int (Employee::*methodPtr) () const { ::getSalary }; Employee employee { "John", "Doe" }; cout << (employee.*methodPtr)() << endl; ``` What is the equivalent D code? Ditto for pointer to class instances: ``` int

Re: Download a file into array (using std.net.curl.download)

2021-07-08 Thread notna via Digitalmars-d-learn
On Wednesday, 7 July 2021 at 13:49:50 UTC, MoonlightSentinel wrote: On Wednesday, 7 July 2021 at 10:27:47 UTC, notna wrote: On Windows: [...] Nice and helpful Error messages is on the top of our desires list, right? It's hard to give proper error backtraces without debug information (-g).

Re: how to make D program footprint smaller ?

2021-07-08 Thread russhy via Digitalmars-d-learn
On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated` and `asdf` package. it compiled to 27MB binary not

how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated` and `asdf` package. it compiled to 27MB binary not stripped and even 4MB size after stripped. (When compiled to ARM,