Re: Is there any performance penalty for static if?

2019-05-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 15 May 2019 at 22:13:18 UTC, Jonathan M Davis wrote: On Wednesday, May 15, 2019 4:03:39 PM MDT Ferhat Kurtulmuş via Digitalmars- d-learn wrote: [...] If you really want to see what happens (for any piece of code), then you can look at the generated assembly, but static

Re: How to create GTK+ apps with Glade and D on windows

2019-06-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 3 June 2019 at 10:32:25 UTC, Ferhat Kurtulmuş wrote: On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote: [...] I am writing on my cell phone, so cannot address the whole thing. When I started to learn d, I was playing around a boiler plate to imitate something like

Re: How to create GTK+ apps with Glade and D on windows

2019-06-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote: I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.

Re: Is there any performance penalty for static if?

2019-05-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 16 May 2019 at 00:18:25 UTC, user1234 wrote: On Wednesday, 15 May 2019 at 22:03:39 UTC, Ferhat Kurtulmuş wrote: [...] You've been given the answer but about this particular piece of code, rather use the "is" expression static if (is(T == float)) {} else static if (is(T ==

Is there any performance penalty for static if?

2019-05-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
Hi, Maybe I already know the answer, but have to be sure about this. I am emulating this cpp code "int val = mat.at(row, col)" like: T at(T)(int row, int col){ static if (T.stringof == "float"){ return getFloatAt(row, col); } else static if (T.stringof ==

Re: Memory management by interfacing C/C++

2019-04-29 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 29 April 2019 at 00:53:34 UTC, Paul Backus wrote: On Sunday, 28 April 2019 at 23:10:24 UTC, Ferhat Kurtulmuş wrote: You are right. I am rewriting the things using mallocs, and will use core.stdc.stdlib.free on d side. I am not sure if I can use core.stdc.stdlib.free to destroy

Memory management by interfacing C/C++

2019-04-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
Hi, I am wrapping some C++ code for my personal project (opencvd), and I am creating so many array pointers at cpp side and containing them in structs. I want to learn if I am leaking memory like crazy, although I am not facing crashes so far. Is GC of D handling things for me? Here is an

Re: Memory management by interfacing C/C++

2019-04-29 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 29 April 2019 at 14:38:54 UTC, 9il wrote: On Saturday, 27 April 2019 at 22:25:58 UTC, Ferhat Kurtulmuş wrote: [...] Hello Ferhat, You can use RCArray!T or Slice!(RCI!T) [1, 2] as common thread safe @nogc types for D and C++ code. See also integration C++ example [3] and C++

Re: Memory management by interfacing C/C++

2019-04-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 28 April 2019 at 03:54:17 UTC, Paul Backus wrote: On Saturday, 27 April 2019 at 22:25:58 UTC, Ferhat Kurtulmuş wrote: Hi, I am wrapping some C++ code for my personal project (opencvd), and I am creating so many array pointers at cpp side and containing them in structs. I want to

How to do operator overloading for <, >, <=, >=, !=, and == between struct and int?

2019-04-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I am writing an opencv binding and need something like: Mat m = another_mat > 5; Docs does not cover this sitiuation: https://dlang.org/spec/operatoroverloading.html#compare opBinary does not support those operators, and Section "Overloading <, <=, >, and >=" describes overloaded operators

Re: How to do operator overloading for <, >, <=, >=, !=, and == between struct and int?

2019-04-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 21 April 2019 at 18:17:00 UTC, Adam D. Ruppe wrote: On Sunday, 21 April 2019 at 18:07:08 UTC, Ferhat Kurtulmuş wrote: I am writing an opencv binding and need something like: Mat m = another_mat > 5; D does not support that. The comparison operators are always just true or false

Re: Is removing elements of AA in foreach loop safe?

2019-09-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote: Iterating of some structure and removing elements thereby is always errorprone and should be avoided. But: In case of AA, I've got the feeling, that it might be safe: foreach (k,v;ways) if (v.empty) ways.remove(k); Do

Re: Is removing elements of AA in foreach loop safe?

2019-09-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 06:20:00 UTC, berni wrote: On Tuesday, 3 September 2019 at 20:06:27 UTC, Ferhat Kurtulmuş wrote: I know, it is foreach loop in question. How about using a reverse for loop like: for (size_t i = arr.length ; i-- > 0 ; ){ arr.remove(i); } This would be

Re: Is there any writeln like functions without GC?

2019-11-09 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? Upon this post, I thought writing a gc-free writeln would be a good learning practice. Although it is not a feature-complete one, it was a lot of fun to do it :) https://github.com/aferust/stringnogc

Re: A question about postblit constructor

2019-11-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 6 November 2019 at 09:19:04 UTC, Jonathan M Davis wrote: DIP: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1018.md It looks like the release that added copy constructors to the compiler was 2.086 back in May: https://dlang.org/changelog/2.086.0.html

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? It almost never does, it just keeps the option open in case * it needs to throw an exception (like if stdout is closed) * you pass it a

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? I cannot answer why it needs GC but something can be implemented like: import core.stdc.stdio; struct Point { int x; int y; } class Person { string name; uint age; } template

Does betterC work different on windows and linux?

2019-11-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I was trying to make my stupid writeln2 function (https://github.com/aferust/stringnogc/blob/master/source/stringnogc.d) compatible with betterC. writeln2() calls obParse() function which may contain some code incompatible with betterC. However; while the code in the unittest can be compiled and

Re: Does betterC work different on windows and linux?

2019-11-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 14 November 2019 at 16:12:19 UTC, kinke wrote: I can't reproduce this with LDC 1.17.0, after changing `unittest` to `extern (C) int main()` and returning 0 at the end; compiled & linked with `ldc2 -betterC stringnogc.d`. I could also run the code in that way. Probably I have some

Re: Dlang + QtE5 + "Qt Designer": How convert .ui to .d Grafic Interface?

2019-11-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 14 November 2019 at 19:07:56 UTC, Marcone wrote: Hi, I use Dlang with QtE5 to make my programs with GUI. If QT is is not a must, you can go for gtkd + Glade designer. I wrote a small utility to work together with Glade and gtkd. please note that it doesn't convert all fields of

Re: Does betterC work different on windows and linux?

2019-11-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 14 November 2019 at 16:47:59 UTC, kinke wrote: The -betterC for that app doesn't imply that its dependencies are compiled with -betterC too. So either also specify that flag in your library's dub config, or build the app with `DFLAGS=-betterC dub ...`. Thank you, I added some

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 12:06:44 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: [...] I meant the example as an answer to your statement, "I wonder how new memory is

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: [...] I meant the example as an answer to your statement, "I wonder how new memory is

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 12:09:15 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 12:06:44 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: [...] I meant the

A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I am trying to learn behavior of postblit constructor. Below code works as expected when I comment out malloc part of postblit constructor. It writes 4 if malloc part of postblit constructor is commented out. Otherwise it writes default init value of int which is 0. I wonder how new memory is

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 08:47:05 UTC, Ferhat Kurtulmuş wrote: value of int which is 0. I wonder how new memory is allocated without an explicit malloc here. Sorry for this noob question in advance, I could not find any

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: [...] Yep, it is obvious that my code is wrong. s1 and s2 point to the same memory address. I could obtain my desired behavior with copy constructor. The

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 6 December 2019 at 12:34:17 UTC, realhet wrote: Hi, I'm trying to use a popular function name "max", and extend it for my special types: For example: module utils; MyType max(in MyType a, in MyType a){...} //static function struct V3f{ V3f max(in V2f b){...} //member function

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 6 December 2019 at 13:25:24 UTC, realhet wrote: On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş wrote: [...] Thx for answering! [...] In d you can also use scoped imports: https://dlang.org/spec/module.html#scoped_imports

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala wrote: Already >1 year I consider to move from C++ to Dlang or to Rust in my hobby game development (mostly based on physical simulations https://github.com/ProkopHapala/SimpleSimulationEngine). I probably prefer Dlang because it

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:11:37 UTC, Ferhat Kurtulmuş wrote: On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala wrote: Already >1 year I consider to move from C++ to Dlang or to Rust in my hobby game development (mostly based on physical simulations

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 20 October 2019 at 22:48:25 UTC, Jonathan Marler wrote: On Friday, 18 October 2019 at 06:11:37 UTC, Ferhat Kurtulmuş wrote: On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala wrote: Already >1 year I consider to move from C++ to Dlang or to Rust in my hobby game development

Re: matrix operations

2019-11-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 16:16:04 UTC, René Heldmaier wrote: Hi, I'm looking for some basic matrix/vector operations and other numeric stuff. I spent quite a lot time in reading through the mir documentation, but i kinda miss the bigger picture. I'm not a Python user btw. (I know

Re: How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 1 December 2019 at 20:05:40 UTC, Marcone wrote: My program have Qt5 GUI that use dlls, icons, pictures, etc. How bundles a Dlang application and all its dependencies into a single .exe package? There are several tools creating installers such as nsis. However, if you want to make

Re: Is there any writeln like functions without GC?

2019-11-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 11 November 2019 at 16:20:59 UTC, bauss wrote: If you wanted to follow the standard of D then you didn't need a string type. Since it doesn't really exist in D. string is just an alias for immutable(char)[] And that is why std.exception.assumeUnique converts char[] to string

Re: Dynamic Arrays as Stack and/or Queue

2019-10-07 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 7 October 2019 at 17:28:11 UTC, Just Dave wrote: On Monday, 7 October 2019 at 17:24:19 UTC, Ferhat Kurtulmuş wrote: On Monday, 7 October 2019 at 17:11:08 UTC, Just Dave wrote: [...] Built-in D arrays rely on garbage collector, and you don't need an explicit delete. For nogc

Re: Dynamic Arrays as Stack and/or Queue

2019-10-07 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 7 October 2019 at 17:11:08 UTC, Just Dave wrote: I need a stack and a queue and I noticed that the standard library doesn't appear to have one. Which is ok. I just need something that can logically behave as a stack and queue, which I think the dynamic array should be able to do (if

Re: On D's garbage collection

2019-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 16:28:51 UTC, Marcel wrote: I'm been thinking about using D in conjunction with C11 to develop a set of applications with hard real-time requirements. While initially the goal was to use C++ instead, it has become clear that D's introspection facilities will offer

Re: On D's garbage collection

2019-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 16:43:23 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 8 October 2019 at 16:28:51 UTC, Marcel wrote: I'm been thinking about using D in conjunction with C11 to develop a set of applications with hard real-time requirements. While initially the goal was to use C++

Re: GtkD - Add images to IconView with Pixbuf

2020-03-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 2 March 2020 at 16:37:46 UTC, cfcd14f496326e429ce03c48650b7966 wrote: Hello. :-) I found this guide : https://www.kksou.com/php-gtk2/sample-codes/display-a-list-of-thumbnail-images-using-GtkIconView.php This guide used 'Pixbuf' for use fromFile method, but GtkD don't have it. :

Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 21:26:40 UTC, Ron Tarrant wrote: On Wednesday, 22 January 2020 at 09:18:51 UTC, Ferhat Kurtulmuş wrote: Another useful tutorial would be something using bindProperty and/or bindPropertyWithClosures. Once I used bindProperty with vala, but I think there is no

Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 23 January 2020 at 13:41:34 UTC, Ferhat Kurtulmuş wrote: On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote: [...] Yes, but what if you set sensitive properties of a bunch of the widgets in the same time. Each time you have to write and call setSensitive() for each

Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote: On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş wrote: I want this button disabled so that user cannot spawn another thread while the first one is on duty. This is actually the subject of an up-coming post which

Re: readline / Gnu readline

2020-01-29 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 20:01:32 UTC, Michael wrote: I am new to D. I would like to use the Gnu readline function in D. Is there a module that i can use? Found this. But code.dlang.org is having some issues right now. Try accessing it after some time.

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 3 February 2020 at 12:27:41 UTC, Marcone wrote: On Saturday, 1 February 2020 at 08:14:19 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 06:26:04 UTC, Marcone wrote: [...] Disclaimer: did not tried. You must somehow embed this manifest file into your exe using some

Re: How to refer to different sized static arrays

2020-02-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 8 February 2020 at 08:22:46 UTC, Adnan wrote: Just a foreword, this is for learning purposes, hence I am not using the dynamic array or Array!T. I have a structure that maintains a heap allocated sized array inside. struct LifoStack(T) { T[?] data; } T[N] is a static array

Re: How to convert "string" to const(wchar)* ?

2020-01-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 05:17:03 UTC, Marcone wrote: How to convert "string" to const(wchar)* ? The code bellow is making confuse strange characters. cast(wchar*) str this seems working: string s = "test ğüişçöıı"; wstring wstr = s.to!wstring; const(wchar)* str = wstr.ptr;

Re: How to convert "string" to const(wchar)* ?

2020-01-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 06:53:15 UTC, Jonathan M Davis wrote: On Tuesday, January 28, 2020 10:17:03 PM MST Marcone via Digitalmars-d-learn wrote: [...] Of course it is. string is immutable(char)[], and the characters are in UTF-8. immutable(wchar)[] would would be UTF-16. Even

Re: How to convert this C++ code to Dlang? Please send me Dlang version of this C++ code

2020-01-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote: On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote: [...] Thank you very much! But I have this error when I try to compile: Error 42: Symbol Undefined _InitCommonControls@0 Error: linker exited with status 1 I am using

Re: How to call a extern C++ class constructor ?

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:21:54 UTC, norm wrote: On Saturday, 1 February 2020 at 08:38:22 UTC, Luhrel wrote: On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote: On Saturday, 1 February 2020 at 08:21:29 UTC,

Re: Dub - vibe.d - hunt framework ... problems

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: As suggested, i try to build dub from github, following: https://github.com/dlang/dub/releases I don't know if it is a solution. But you can try using ~master branch, not a release on GitHub. You can also try my vibed app

Re: Dub - vibe.d - hunt framework ... problems

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 11:02:45 UTC, seany wrote: On Saturday, 1 February 2020 at 10:58:14 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: As suggested, i try to build dub from github, following: https://github.com/dlang/dub/releases I don't

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 06:26:04 UTC, Marcone wrote: I created a program in Dlang and compiled to exe using dmd. But my program need administrator privileges. How can I make executable dlang program ask for administrator privileges on start up program? Disclaimer: did not tried. You

Re: How to call a extern C++ class constructor ?

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 08:15:20 UTC, Luhrel wrote: Hello there, I would like to know how can I call a C++ ctor. [...] You cannot. https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d You must use a factory method like createInstance.

Re: How to call a extern C++ class constructor ?

2020-02-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote: On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat Kurtulmuş wrote: You cannot. https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d You must use a factory method like createInstance. Oh I see, so there's

Re: about const ref

2020-02-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 09:20:11 UTC, Mathias Lang wrote: On Tuesday, 11 February 2020 at 07:51:04 UTC, Ferhat Kurtulmuş wrote: You're correct for 'a' and 'b'. However `in` only entails `const`, so it is not an exact replacement. Additionally, you might want to add `scope` to show

about const ref

2020-02-10 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I need to be sure about "const ref". Based on the following function, does it mean: Type can be string or an integral type. (a) k1 is not copied on function calls (b) k1 cannot be modified inside function Please correct me if I am wrong. Can storage class "in" be used to satisfy (a) and (b)?

rt/aaA.d Line: 553

2020-02-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I hesitated to post this on the topic of druntime because probably I will learn something new if I am totally/stupidly wrong. In druntime/blob/master/src/rt/aaA.d Lines 553-562: ... auto p = aa.findSlotInsert(hash); if (p.deleted) --aa.deleted; // check load factor and

Re: rt/aaA.d Line: 553

2020-02-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 14 February 2020 at 23:19:31 UTC, Paul Backus wrote: On Friday, 14 February 2020 at 22:57:31 UTC, Ferhat Kurtulmuş wrote: findSlotInsert are called two times. Why not: if (++aa.used * GROW_DEN > aa.dim * GROW_NUM) aa.grow(ti.key); auto p = aa.findSlotInsert(hash);

Re: rt/aaA.d Line: 553

2020-02-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 14 February 2020 at 23:28:39 UTC, Steven Schveighoffer wrote: On 2/14/20 5:57 PM, Ferhat Kurtulmuş wrote: One thing to learn, you can select a section of lines from github (click on first line, then shift-click on last line), then press the 'y' key, and it will generate a

Re: rt/aaA.d Line: 553

2020-02-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 15 February 2020 at 14:30:20 UTC, Steven Schveighoffer wrote: On 2/15/20 6:49 AM, Ferhat Kurtulmuş wrote: On Friday, 14 February 2020 at 23:41:45 UTC, Steven I'll note that you are going to leak some memory because you are not freeing deleted buckets when you resize. In the GC

Re: rt/aaA.d Line: 553

2020-02-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 14 February 2020 at 23:41:45 UTC, Steven Schveighoffer wrote: On 2/14/20 6:36 PM, Ferhat Kurtulmuş wrote:     İf ((aa.used + 1)* GROW_DEN > aa.dim * GROW_NUM)     aa.grow(ti.key); This call is expensive (it reallocates all the buckets and reinserts all the existing data into

Re: rt/aaA.d Line: 553

2020-02-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 15 February 2020 at 15:21:08 UTC, Ferhat Kurtulmuş wrote: On Saturday, 15 February 2020 at 14:30:20 UTC, Steven Schveighoffer wrote: On 2/15/20 6:49 AM, Ferhat Kurtulmuş wrote: On Friday, 14 February 2020 at 23:41:45 UTC, Steven Ops I ve made commits. Here are the links up to

Re: books for learning D

2020-01-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Depending on your background:

Re: books for learning D

2020-01-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 14:02:59 UTC, Ron Tarrant wrote: Today's post was requested by Joel Christensen, how to have one button affect another. You can find it here: https://gtkdcoding.com/2020/01/21/0099-sfx-button-interactions-i-text-labels.html Another useful tutorial would be

Re: Calling D code from C

2020-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 19:05:29 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2020 at 06:12:01PM +, Stefan via Digitalmars-d-learn wrote: [...] But you can easily do the initialization in your D code, by calling rt_init() and rt_term(), like this: [...] extern(C) int rt_init();

how to get current timestamp?

2020-01-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
Is there any built-in method returning current timestamp like doing it in python like: time.time() which returns something like 1577990478.4675508?

Re: how to get current timestamp?

2020-01-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 2 January 2020 at 18:56:37 UTC, bachmeier wrote: On Thursday, 2 January 2020 at 18:41:59 UTC, Ferhat Kurtulmuş wrote: Is there any built-in method returning current timestamp like doing it in python like: time.time() which returns something like 1577990478.4675508? I use import

Re: A set type implemented as an AA wrapper

2020-03-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 12 March 2020 at 08:51:24 UTC, mark wrote: I use sets a lot and since I believe that D's rbtree is O(lg n) for add/remove/in and that D's AA is O(1) for these, I want to implement a set in terms of an AA. XXX: I need to use an if on the struct to restrict T to be a type that

Re: Trying to understand a simple piece of code: dmd barray

2020-03-07 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 7 March 2020 at 13:06:39 UTC, Dibyendu Majumdar wrote: On Saturday, 7 March 2020 at 12:26:32 UTC, drug wrote: I am trying to understand https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d. Two questions: 1. What does this mean and why is it needed? line 95: alias

Re: Introduction and request for help

2020-03-10 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 9 March 2020 at 22:48:35 UTC, Kendell wrote: Hey Everyone, I'm a new D developer and therefore new to Gtkd. By day I'm an android developer using Kotlin and most of my hobby projects are in Go. [...] I opened an issue about a year ago when I started playing around with d.

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 07:46:00 UTC, drug wrote: On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote: On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş extern(C++, cv){ extern(C++, class) struct Size_(_Tp){     @disable this();    

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 09:28:15 UTC, drug wrote: On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote: Ok, here is a solution. I opened my lib (yielded by my auxilary cpp) using 7zip. There are two files containing symbol names, 1.txt and 2.txt. I searched for names of member functions. They

Re: Best way to learn 2d games with D?

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 18:45:14 UTC, Steven Schveighoffer wrote: On 3/15/20 2:14 PM, bauss wrote: [...] [snip] [...] Thanks, I'm pretty much starting from zero as I have very little experience in what is necessary to actually do the drawing parts, or how to store/manipulate sprites

Re: Best way to learn 2d games with D?

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 19:02:11 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 18:45:14 UTC, Steven Schveighoffer wrote: [...] I refer this ugly site a lot for basics of SDL. Since one could easily convert c code to d, transition is very fast. My favorite 2d game engine is

What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
The original C++ class https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315: template class Size_ { public: typedef _Tp value_type; //! default constructor Size_(); Size_(_Tp _width, _Tp _height); Size_(const Size_& sz);

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote: On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş extern(C++, cv){ extern(C++, class) struct Size_(_Tp){ @disable this(); ~this() { } final _Tp area() const; final double aspectRatio() const; final bool

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it returns an instance. extern(C++){ cv.Size_!int createSizeInt(); cv.Size_!int

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 20:46:14 UTC, drug wrote: 15.03.2020 23:25, Ferhat Kurtulmuş пишет: On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote: 15.03.2020 22:39, Ferhat Kurtulmuş пишет: What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:16:43 UTC, Arine wrote: On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş I wouldn't use a class on the D side, unless your C++ type uses virtual functions. Classes in D are different from structs, it is not the same as C++ where they are basically the

Re: No implicit opOpAssign for structs with basic types?

2020-04-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 4 April 2020 at 10:22:29 UTC, Robert M. Münch wrote: D doesn't have implicit operators for structs? struct S {float a, float b}; S a = {1, 5}; S b = {2, 5); a += b; Error: a is not a scalar, it is a S So I really have to write an overloaded operator for such cases? Probably I

Re: No implicit opOpAssign for structs with basic types?

2020-04-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 4 April 2020 at 12:14:23 UTC, Robert M. Münch wrote: On 2020-04-04 10:32:32 +, Ferhat Kurtulmuş said: struct S { float a; float b; S opOpAssign(string op)(ref S rhs) if (op == "+"){ this.a += rhs.a; this.b += rhs.b; return this;

Re: linking obj files compiled with LDC2 1.20.0 on Win64

2020-03-26 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 22 March 2020 at 18:43:50 UTC, realhet wrote: Hello, I'm try to use the latest LDC2 version: 1.20.0 Previously I used 1.6.0 [...] Try to run the compiler in visual studio command line terminal.

Re: Best way to learn 2d games with D?

2020-03-22 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start

Re: BetterC + WASM Update

2020-09-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 20:39:58 UTC, Mike Brown wrote: Is there an alternative that works with BetterC for dynamic arrays? You may give these a try: https://github.com/aferust/dvector For associative arrays: https://github.com/aferust/bcaa

Re: bindbc OpenGL ES

2020-08-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 31 August 2020 at 14:04:19 UTC, Danny Arends wrote: Don't know exactly where to post this, so I hope the bindbc team will see the post here in learn. I was wondering if it would be possible to have bindbc OpenGL ES bindings ? I'm working on porting my 3D Engine to Android, and

Re: bindbc OpenGL ES

2020-08-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 31 August 2020 at 16:56:45 UTC, Danny Arends wrote: On Monday, 31 August 2020 at 15:16:40 UTC, Ferhat Kurtulmuş wrote: On Monday, 31 August 2020 at 14:04:19 UTC, Danny Arends wrote: [...] I have never tried, but this repo may help. I know that it supports d.

Re: Trying to create a trivial 64 bit D Lang DLL on a Windows 10 machine and cant get past linking.

2020-10-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 2 October 2020 at 07:34:03 UTC, WhatMeWorry wrote: On Thursday, 1 October 2020 at 21:56:46 UTC, Ferhat Kurtulmuş wrote: On Thursday, 1 October 2020 at 21:35:42 UTC, WhatMeWorry wrote: On Thursday, 1 October 2020 at 20:28:58 UTC, kinke wrote: [...] Thanks all. I've gotten it to

Re: Trying to create a trivial 64 bit D Lang DLL on a Windows 10 machine and cant get past linking.

2020-10-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 2 October 2020 at 08:33:25 UTC, Imperatorn wrote: On Friday, 2 October 2020 at 08:07:33 UTC, Ferhat Kurtulmuş wrote: On Friday, 2 October 2020 at 07:34:03 UTC, WhatMeWorry wrote: On Thursday, 1 October 2020 at 21:56:46 UTC, Ferhat Kurtulmuş wrote: [...] Yes, I've been doing that.

Re: How to spawn a thread within a GtkD button event handler

2020-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 8 October 2020 at 15:59:15 UTC, Alaindevos wrote: Because when the eventhandler takes to much time the application is no longer responsive. And even a simple redraw request is not performed before ending of the thread. A small and short demo app would nice. Or guideline and

Re: How to spawn a thread within a GtkD button event handler

2020-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 8 October 2020 at 17:02:55 UTC, Alaindevos wrote: One thing I want to do is in an eventhandler of a button released event which takes minutes in duration to change the state of the statusbar indicating something is going on. But the statusbar is not redrawn before the evenhandler

Re: How to spawn a thread within a GtkD button event handler

2020-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 8 October 2020 at 19:57:12 UTC, Alaindevos wrote: The idea looked good but gtk was unhave when 1000 labels where updated by another thread. Are you using Idle? If yes, and still having issues? Sorry, I cannot help further.

Re: How to spawn a thread within a GtkD button event handler

2020-10-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 8 October 2020 at 19:53:26 UTC, Alaindevos wrote: I created blindly a thread and this allowed to do stuff in background. But when i passed the mainwindow as argument and did some stuff it resulted in, [xcb] Unknown sequence number while processing queue [xcb] Most likely this is a

Re: How auto convert Variant to required function arguments?

2020-10-09 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 9 October 2020 at 15:49:31 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio; Variant a; int mul2(Variant b){    int c = *b.peek!(int);    return

Re: How auto convert Variant to required function arguments?

2020-10-09 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio; Variant a; int mul2(Variant b){    int c = *b.peek!(int);    return 2*c; } int mul3(int b){ return 3*b; } void main() {    a = 5;

Re: How auto convert Variant to required function arguments?

2020-10-09 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 9 October 2020 at 16:10:03 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 15:49:31 UTC, Ferhat Kurtulmuş wrote: On Friday, 9 October 2020 at 00:19:20 UTC, Marcone wrote: How auto convert Variant to required function arguments? import std.variant; import std.stdio;

Re: GtkD CRUD Application

2020-10-17 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 17 October 2020 at 14:53:35 UTC, Alaindevos wrote: I've written the beginning but dont know how to end. What is the way to add functionality for the add,edit,delete button ? //== I put an example[1] here. The fields are not editable. You will

Re: Compiler is calling `_memset64` in betterC

2020-10-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 18 October 2020 at 17:05:01 UTC, Neto wrote: On Sunday, 18 October 2020 at 16:12:59 UTC, Paul Backus wrote: On Sunday, 18 October 2020 at 16:04:55 UTC, Koro wrote: I'm writing a 'betterC' program and the compiler is generating a call to '_memset64' if I have an array literal where

Re: Compiler is calling `_memset64` in betterC

2020-10-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 19 October 2020 at 14:07:38 UTC, matheus wrote: On Sunday, 18 October 2020 at 19:24:28 UTC, Ferhat Kurtulmuş wrote: I plan to start a project in reasonable size, I wonder if I should really use betterC... if I encounter a bug like this, will I be stuck at it? The bug report says,

  1   2   3   >