Re: string version of array

2017-11-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/11/2017 7:54 AM, Tony wrote: Is there an easy way to get the string representation of an array, as would be printed by writeln(), but captured in a string? struct Foo { int x; } void main() { Foo[] data = [Foo(1), Foo(2), Foo(3)]; import std.conv :

Re: string version of array

2017-11-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/11/2017 8:16 AM, Andrea Fontana wrote: On Tuesday, 14 November 2017 at 07:56:06 UTC, rikki cattermole wrote: On 14/11/2017 7:54 AM, Tony wrote: Is there an easy way to get the string representation of an array, as would be printed by writeln(), but captured in a string? struct Foo {    

Re: dmd/ldc failed with exit code -11

2017-11-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/11/2017 12:15 AM, Anonymouse wrote: I have a large named enum (currently 645 members) of IRC event types. It's big by neccessity[1]. I'm using dub, and both dmd and ldc successfully build it in test and debug modes, but choke and die on plain and release. I bisected it down to when I

Re: ESR on post-C landscape

2017-11-15 Thread rikki cattermole via Digitalmars-d-learn
On 16/11/2017 6:35 AM, Ola Fosheim Grostad wrote: On Thursday, 16 November 2017 at 02:12:10 UTC, codephantom wrote: Perhaps the mistake C++ made, was concluding that 'classes' were the "proper primary focus of program design" (chp1. The Design and Evolution of C++). No, classes is a powerful

Re: Best practices for multithread global flags

2017-11-15 Thread rikki cattermole via Digitalmars-d-learn
On 15/11/2017 11:57 AM, Vladimirs Nordholm wrote: Hello people from D-land. To summarise my problem: I have a program in the terminal (Posix) with two threads: one which my main program is run on, and a second one which polls input via `poll(...)` and `read(...)`. Let's call main thread T1,

Re: private keyword dont appear to do anything

2017-11-03 Thread rikki cattermole via Digitalmars-d-learn
Visibility modifiers like private, and public are to the module not the scope. "Symbols with private visibility can only be accessed from within the same module." This is how module based languages work, a bit more useful then to the scope approach IMO. An easy mistake to make.

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread rikki cattermole via Digitalmars-d-learn
On 01/11/2017 11:13 PM, Jonathan M Davis wrote: On Wednesday, November 01, 2017 20:53:44 Dr. Assembly via Digitalmars-d- learn wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start

Re: fputs, stdout

2017-11-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/11/2017 4:34 AM, Tony wrote: There is a fputs/stdout in core.stdc.stdio.  std.stdio "public imports" that: "public import core.stdc.stdio;" Wondering why: import core.stdc.stdio : fputs; import core.stdc.stdio : stdout; void main() {    fputs( cast(const char *)"hello

Re: How you guys go about -BetterC Multithreading?

2017-11-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/11/2017 4:00 PM, Petar Kirov [ZombineDev] wrote: On Thursday, 9 November 2017 at 13:00:15 UTC, ParticlePeter wrote: On Thursday, 9 November 2017 at 12:19:00 UTC, Petar Kirov [ZombineDev] wrote: On Thursday, 9 November 2017 at 11:08:21 UTC, ParticlePeter wrote: Any experience reports or

Re: How you guys go about -BetterC Multithreading?

2017-11-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/11/2017 12:19 PM, Petar Kirov [ZombineDev] wrote: On Thursday, 9 November 2017 at 11:08:21 UTC, ParticlePeter wrote: Any experience reports or general suggestions? I've used only D threads so far. It would be far easier if you use druntime + @nogc and/or de-register latency-sensitive

Re: Issue with sc.ini within XMake build infrastructure

2017-11-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/11/2017 12:42 PM, Andre Pany wrote: Hi, I have a windows slave on which the dmd archive is extracted and dub is executed using build scripts. The windows slave has Visual Studio 2017 installed. I would like to switch from OMF to COFF executables to also allow 64 bit compilations. My

Re: Issue with sc.ini within XMake build infrastructure

2017-11-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/11/2017 1:56 PM, Andre Pany wrote: On Thursday, 2 November 2017 at 12:21:50 UTC, rikki cattermole wrote: Override the shipped sc.ini file with your own. Simple and effective solution. What I just found out, by calling the batch file "vcvars64.bat" from the visual studio folder it

Re: Passing Function as an argument to another Function

2017-12-04 Thread rikki cattermole via Digitalmars-d-learn
On 04/12/2017 8:22 AM, Vino wrote: Hi All,   Request your help on the below code, I want to send the name of the function ( First and Second) from main as an argument to another function(Mid) and the function "Mid" has to execute the function(First and Second). Program: import std.stdio;

Re: Passing Function as an argument to another Function

2017-12-04 Thread rikki cattermole via Digitalmars-d-learn
On 04/12/2017 10:36 AM, Vino wrote: Hi Rikki,   Thank you very much, I tired the above code and it is working, so another help on the same topic. IF my function (First) of below type when who do we define the Mid function Array!(Tuple!(string, string))  First(string Ftext) Tried the below 

Re: GC in D and synadard library.

2017-12-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/12/2017 10:49 AM, Dan Partelly wrote: I started to look into D very recently. I would like to know the following, if you guys are so nice to help me: 1. What is the performance of D's GC, what trade-offs where done in design , and if a in-deep primer on efficient usage and gotchas of

Re: Line breaks in JSON

2018-05-10 Thread rikki cattermole via Digitalmars-d-learn
On 11/05/2018 2:56 AM, bachmeier wrote: I'm using std.json for the first time. I want to download the contents of a markdown file from a web server. When I do that, the line breaks are escaped, which I don't want. Here's an example: import std.conv, std.json, std.stdio; void main() {

Re: Examples/tutorials for OpenGL games which works out-of-the-box on linux

2018-05-20 Thread rikki cattermole via Digitalmars-d-learn
On 20/05/2018 8:06 PM, Prokop Hapala wrote: Hi, I'm looking for examples of OpenGL games which I can use as templates for making my own stuff. But I'm quite discouraged that everything I found on github is probably outdated and fails to compile. Since I'm not very familiar with dub

Re: C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-16 Thread rikki cattermole via Digitalmars-d-learn
On 17/05/2018 3:07 AM, Robert M. Münch wrote: I have an extern(C) function in a DLL with this signature: result* myfunc(double x, double y, const char *text, stuff *myStuff, bool flag); I call it like this: result = myfunc(0, 0, std.string.toStringz("1"), stuff, true); The problem is,

Re: Copying an std.stdio.File into another one

2018-05-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/05/2018 11:50 PM, 0xEAB wrote: What's the correct way to copy a `File` into another one in D? If `LockingTextReader` wasn't undocumented, I'd have gone for that approach: import std.algorithm.mutation : copy; import std.stdio : File, LockingTextReader; void main() {     auto a =

Re: How do I see the flags passed from dub to the compiler?

2018-05-21 Thread rikki cattermole via Digitalmars-d-learn
On 22/05/2018 4:21 AM, Dr.No wrote: where's this stored? -v should do the trick

Re: Locking data

2018-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2018 1:20 AM, Malte wrote: On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions wrote: an idea to lock data by removing the reference: class A {    Lockable!Data data; } [...] This sounds like you are looking for is an atomic swap. Afaik it doesn't exist in the standard

Re: Locking data

2018-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2018 1:29 AM, Malte wrote: On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole wrote: On 24/05/2018 1:20 AM, Malte wrote: On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions wrote: an idea to lock data by removing the reference: class A {    Lockable!Data data; }

Re: toString OutputWriter method not calling derived class

2018-05-25 Thread rikki cattermole via Digitalmars-d-learn
On 25/05/2018 9:21 PM, cc wrote: When defining a toString(W)(ref W writer) function on a base class and derived class, only the version on the base class is called when formatting into a string.  Is this intended behavior? import std.format; import std.range.primitives; class Foo {

Re: Stopping compile time execution

2018-05-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/05/2018 3:58 AM, Russel Winder wrote: I have a bit of code which is the definition of a class Preferences, which has: this() { filePath = expandTilde(chainPath("~", ".config", "me-tv", "preferences.yml").array); filePath is a member of the class. Now if I have a

Re: return type of std.algorithm.mutation.reverse changed for good?

2018-05-24 Thread rikki cattermole via Digitalmars-d-learn
On 25/05/2018 12:06 AM, biocyberman wrote: I am testing with DMD 2.078.2 locally. This tiny snippet works on dlang's online editor: https://run.dlang.io/is/nb4IV4 But it does not work on my local dmd. import std.algorithm.mutation; import std.stdio; char[] arr =

Re: Runtime introspection, or how to get class members at runtime Fin D

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:44 AM, Arafel wrote: On 06/06/2018 03:30 PM, rikki cattermole wrote: You don't want TypeInfo. Why not (genuine question)? There's even myObject.classinfo, and I can only assume that there's some reason why it's there... In this case, what I'm trying to do is to serialize

Re: Runtime introspection, or how to get class members at runtime Fin D

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:28 AM, Arafel wrote: Hi, What is the state of runtime introspection in D, specifically for classes? Is there any way to get *at runtime* the (public or otherwise accessible) members of a class? No. I have had a look as TypeInfo_Class [1], but apparently I can only get a

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 10:29 PM, cc wrote: And it successfully fires the 3-arg Run method of the callback object. However for some reason the function table of the ISteamClient seems to be off by one.. it kept calling the wrong methods until I commented one out, in this case GetIntPtr() as seen above,

Re: WTF! new in class is static?!?!

2018-06-09 Thread rikki cattermole via Digitalmars-d-learn
But unlike you "king", Bauss isn't using tor to ban evade.

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 11:28 PM, cc wrote: Woops, that GetIntPtr came from the .cs header in the same folder as the C++ headers distributed with the SDK, that'll teach me to ctrl+f "class ISteamClient" in all open files and copy/paste before reading. Stay with the c/c++ headers for c/c++ code. We

Re: Why does using zlib without pragma(lib, ...) work?

2018-06-07 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 11:47 PM, tipdbmp wrote: The following compiles without pragma(lib, ...): extern(C) {     const(char)* zlibVersion(); } void main() {     const(char)* sz = zlibVersion(); } It has already been compiled in as part of Phobos.

Re: Why does using zlib without pragma(lib, ...) work?

2018-06-07 Thread rikki cattermole via Digitalmars-d-learn
On 08/06/2018 12:25 AM, tipdbmp wrote: What other libraries (if any) are part of Phobos? That is pretty much it.

Re: foreach DFS/BFS for tree data-structure?

2018-06-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/06/2018 11:31 PM, Robert M. Münch wrote: I have a simple tree C data-structure that looks like this: node { struct Node { node parent: Node* parent; vector[node] children; Node[] children; } I would like to create two foreach algorthims, one follwing the breadth

Re: how to determine of a module or any other symbol is visible?

2018-06-18 Thread rikki cattermole via Digitalmars-d-learn
On 18/06/2018 9:24 PM, Mr.Bingo wrote: On Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote: On 18/06/2018 9:03 PM, Mr.Bingo wrote: In the code I posted before about CRC, sometimes I get a visibility error for some modules. I would like to be able to filter those out using traits.

Re: how to determine of a module or any other symbol is visible?

2018-06-18 Thread rikki cattermole via Digitalmars-d-learn
On 18/06/2018 9:03 PM, Mr.Bingo wrote: In the code I posted before about CRC, sometimes I get a visibility error for some modules. I would like to be able to filter those out using traits. Is there any way to determine if a module is visible/reachable in the current scope? The modules that

Re: Create a List or Dictionary.

2018-06-18 Thread rikki cattermole via Digitalmars-d-learn
On 18/06/2018 11:44 PM, Sunny wrote: Hello, I'm having a problem, how can I create a List or Dictionary in D? In C #, I can create a tuple list, example: var musicList = new List <(string URL, string Artist, string Title, string Cover, string Duration)> (); In Google did not find anything,

Re: Native PDB Error

2018-05-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/05/2018 7:47 PM, Begah wrote: I have recently reinstalled a fresh version of Windows 10. I installed DMD 1.9.0 and compiled my code ( that was compiling before reinstalling Windows ). What? That is definitely not a valid dmd version for D2.

Re: Line endings when redirecting output to file on windows.

2018-06-03 Thread rikki cattermole via Digitalmars-d-learn
On 04/06/2018 3:24 AM, Bastiaan Veelo wrote: I need some help understanding where extra '\r' come from when output is redirected to file on Windows. First, this works correctly:  rdmd --eval="(\"hello\" ~ newline).toFile(\"out.txt\");" As expected, out.txt contains "hello\r\n". I would

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!uint) as function argument Range is the type, you want the value I

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 2:27 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole wrote: On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: [...] Yes. hmm, and sorry for asking

Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread rikki cattermole via Digitalmars-d-learn
On 28/05/2018 1:02 AM, loloof64 wrote: Hello everyone, I've just completed the language tour, and I am starting a tutorial in order to use Gtk binding. But somewhere, they use the 'in' keyword for the constructor : (https://sites.google.com/site/gtkdtutorial/#chapter2 : in section 3 for

Re: High memory usage in vibe.d application

2018-06-29 Thread rikki cattermole via Digitalmars-d-learn
On 30/06/2018 4:49 AM, Bauss wrote: I wouldn't really blame the GC. There is a higher chance you're just not using it how it's meant to be, especially since it looks like you're mixing manual memory management with GC memory. Let's be honest, I don't think it was meant to live in a container

Re: Code failing unknown reason out of memory, also recursive types

2018-06-25 Thread rikki cattermole via Digitalmars-d-learn
Let me get this straight, you decided to max out your memory address space /twice over/ before you hit run time, and think that this would be a good idea?

Re: First run after build on Windows is slow

2018-06-26 Thread rikki cattermole via Digitalmars-d-learn
On 27/06/2018 12:25 AM, phs wrote: Hello. I've made a simple hello world program using dub and dmd for Windows. Everything works well, except that every first run after each rebuild takes around 3 seconds just to start up. Is it normal at all? Its normal if you don't add an exclusion for that

Re: DerelictVorbis and string pointer

2018-06-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/06/2018 1:26 PM, ANtlord wrote: Hello D community! I'm developing an application that must work on audio especially playback Ogg files. So I took library DerelictVorbis [0] testing basic functions like `ov_fopen`. The tests were successful so I decided to implement core components of

Re: High memory usage in vibe.d application

2018-06-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/06/2018 7:42 PM, Anton Fediushin wrote: On Saturday, 30 June 2018 at 05:00:35 UTC, rikki cattermole wrote: On 30/06/2018 4:49 AM, Bauss wrote: I wouldn't really blame the GC. There is a higher chance you're just not using it how it's meant to be, especially since it looks like you're

Re: Concatenate strings at compile-time

2018-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2018 12:38 AM, Jonathan M. Wilbur wrote: I have a method that cannot be @nogc only because it concatenates strings for a long exception message, as seen below.     throw new ASN1ValuePaddingException     (     "This exception was thrown because you

Re: Out of memory during compilation

2018-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2018 3:21 AM, Matt Gamble wrote: On Wednesday, 2 May 2018 at 14:31:16 UTC, rikki cattermole wrote: On 03/05/2018 2:25 AM, Matt Gamble wrote: [...] Let me start by saying shared library support doesn't work (some people will say it does work partially, but it doesn't). The problem

Re: Out of memory during compilation

2018-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2018 2:25 AM, Matt Gamble wrote: I have a large program (for me) with several thousand lines of code. Recently when I've tried to compile under debug (-g -unittest)  with VS2017, dmd2.076.1, windows 10, 8Gb ram), I've had the following output: Compiling SKaTERoptimizerD.d... Fatal

Re: Why does enumerate over range return dchar, when ranging without returns char?

2018-05-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2018 5:44 PM, James Blachly wrote: I am puzzled why enumerating in a foreach returns a dchar (which forces me to cast), whereas without the enumerate the range returns a char as expected. Example: ``` import std.stdio; import std.range : enumerate; void main() { char[] s =

Re: D in SUSE Enterprise Linux

2018-05-01 Thread rikki cattermole via Digitalmars-d-learn
On 02/05/2018 2:56 AM, Vino wrote: Hi All,  Request your help, trying to execute the below program in SUSE Linux but there is no output Code #!/usr/bin/env rdmd import std.stdio; void main() { writeln("Test"); } DMD Version : DMD64 D Compiler v2.079.1 Package installed :

Re: Coding Challenges at Dconf2018: Implement Needleman–Wunsch and Smith–Waterman algorithms

2018-05-01 Thread rikki cattermole via Digitalmars-d-learn
On 01/05/2018 9:00 PM, biocyberman wrote: On Monday, 30 April 2018 at 20:34:41 UTC, Steven Schveighoffer wrote: On 4/30/18 2:47 PM, biocyberman wrote: Hellow D community. I am attending Dconf 2018 and giving a talk there on May 4. Link: https://dconf.org/2018/talks/le.html. It will be very

Re: D in SUSE Enterprise Linux

2018-05-01 Thread rikki cattermole via Digitalmars-d-learn
On 02/05/2018 3:51 AM, Vino wrote: On Tuesday, 1 May 2018 at 15:42:38 UTC, Jonathan M Davis wrote: On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn wrote: On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote: > On 02/05/2018 2:56 AM, Vino wrote: >> [...] > > Does this

Re: Why does enumerate over range return dchar, when ranging without returns char?

2018-05-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2018 9:50 PM, ag0aep6g wrote: On 05/03/2018 07:56 AM, rikki cattermole wrote: ``` import std.stdio; import std.range : enumerate; void main() {  char[] s = ['a','b','c']; char[3] x; auto i = 0; foreach(c; s) { x[i] = c; i++; }

Re: Static if on release build

2017-10-19 Thread rikki cattermole via Digitalmars-d-learn
On 20/10/2017 3:36 AM, Fra Mecca wrote: I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) {  

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/12/2017 12:59 PM, rjframe wrote: On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote: On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: The problem is that interfaces are a runtime thing (e.g. you can cast a class to an interface) structs implement compile time

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread rikki cattermole via Digitalmars-d-learn
Structs are structs, classes are classes. C++ had the mixed model similar to what you suggested, we got it right and kept it nice and separate. This was done on purpose.

Re: Does dub support generating source files?

2018-01-06 Thread rikki cattermole via Digitalmars-d-learn
On 06/01/2018 1:23 PM, Bastiaan Veelo wrote: Hi, One of my source files (epparser.d) should be generated by calling rdmd on another soure file (make.d) and therefore should depend on changes in make.d and an additional module (epgrammar.d). An include path to Pegged is required for

Re: Version Cygwin

2017-12-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/12/2017 4:22 PM, Anonymouse wrote: Cygwin is a reserved version[1], alongside Windows and linux and the like. However it doesn't seem to be automatically recognised. import std.stdio; void main() {     version(Cygwin) writeln("Cygwin"); } Compiled from a Cygwin prompt this prints

Re: [DMD or LDC] Is it possible to get the GC to print to stdout when it collects?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 23/12/2017 11:06 AM, Chris Katko wrote: I'm having a strange stuttering issue in my game prototype. I use GC allocations wildly for the heck of it at the moment--with eventual plans to remove them. However, I'm not positive it's the GC that's the problem, and if so, I want to know exact

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 1:20 AM, Stijn wrote: https://dlang.org/spec/betterc.html doesn't mention struct constructors not working, but I'm getting linker errors when trying to call a struct constructor. Consider the following program betterc.d     struct foo     {     }     extern(C) void main()

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 1:25 AM, Stijn wrote: On Sunday, 24 December 2017 at 01:21:53 UTC, rikki cattermole wrote: On 24/12/2017 1:20 AM, Stijn wrote: [...] new uses GC. It has nothing to do with structs. Oh I see, simply removing 'new' solves the problem. I've a C# background, so I hadn't thought

Re: betterC current consequences

2017-12-24 Thread rikki cattermole via Digitalmars-d-learn
On 24/12/2017 10:02 AM, Amorphorious wrote: The docs states Consequences As no Druntime is available, many D features won't work. For example:     Garbage Collection     Thread-local storage     TypeInfo and ModuleInfo     Classes     Built-in threading (e.g. core.thread)     Dynamic

Re: DUB and lib curl (-lcurl)

2018-01-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/01/2018 5:42 AM, Tony wrote: I am on Ubuntu 16.04. I was looking at Getting Started with DUB: http://code.dlang.org/getting_started I did the "dub init myproject" and it worked fine. Then I added dependency: ' dependency "dub" version="~>1.3.0" ' as shown in the next step. This got an

Re: MapViewOfFileEx: Not enough storage is available to process this command.

2018-01-26 Thread rikki cattermole via Digitalmars-d-learn
On 26/01/2018 12:16 PM, Andre Pany wrote: Hi, in my application I create a zip archive with a size of ~ 400 MB and after that I read the archive. While trying to read the archive, there is an error: std.windows.syserror.WindowsException@std\mmfile.d(267): MapViewOfFileEx: Not enough

Re: MapViewOfFileEx: Not enough storage is available to process this command.

2018-01-26 Thread rikki cattermole via Digitalmars-d-learn
On 26/01/2018 12:32 PM, Andre Pany wrote: On Friday, 26 January 2018 at 12:19:10 UTC, rikki cattermole wrote: Could be heap fragmentation to who knows what else assuming of course this is 32bit right? If so, 64bit is the answer. Thanks for the hint. 64bit solves the issue. Should I anyway

Re: String Type Usage. String vs DString vs WString

2018-01-14 Thread rikki cattermole via Digitalmars-d-learn
On 15/01/2018 2:05 AM, Chris P wrote: Hello, I'm extremely new to D and have a quick question regarding common practice when using strings. Is usage of one type over the others encouraged? When using 'string' it appears there is a length mismatch between the string length and the char array

Re: Further questions on interfacing to Postgres libpq

2018-01-26 Thread rikki cattermole via Digitalmars-d-learn
On 27/01/2018 5:11 AM, Joe wrote: An example test program that I'm using to learn D to C interfacing (specifically calling the libpq library) has a call to a C function declared as follows:     void PQprint(FILE *fout,  /* output stream */ const PGresult *res,  

Re: Wiki spam

2018-02-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/02/2018 6:34 AM, Tony wrote: Don't know if there is a better place to report this, but the wiki attracted a spammer: https://wiki.dlang.org/The_Search_Of_Charter_Yacht_Designer https://wiki.dlang.org/User:MichelMeudell General

Re: How to proceed with learning to code Windows desktop applications?

2018-01-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/01/2018 11:56 PM, welkam wrote: On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote: The other way I've been thinking is to do the thing browser-based, but for some reason that doesn't feel right. Well it didnt felt wrong for Microsoft to use modified internet explorer to

Re: How to proceed with learning to code Windows desktop applications?

2018-01-29 Thread rikki cattermole via Digitalmars-d-learn
On 30/01/2018 5:47 AM, thedeemon wrote: On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole wrote: But since Windows is the only platform mentioned or desired for, everything you need is in WinAPI! It's like saying "everything you need is assembly language" when talking about

Re: Interfacing with C++

2018-02-04 Thread rikki cattermole via Digitalmars-d-learn
On 04/02/2018 7:54 AM, infinityplusb wrote: Hi all I'm looking to try and write an interface to C++, but given I'm a casual dabbler in D, it's slightly beyond my current ability in terms of both C++ and D! As a leg up, how would one translate something like this from C++ to D? `typedef int

Re: DLangUI Drag and Drop support?

2018-02-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/02/2018 6:06 PM, Andres Clari wrote: Hi, is there support for drag and drop in dlangui?? I haven't found anything on the docs, issues or forums. I'm building a project that requires support for dropping URLs from the browser into a ListWidget. Is this possible with dlangui at all? No.

Re: more OO way to do hex string to bytes conversion

2018-02-06 Thread rikki cattermole via Digitalmars-d-learn
On 06/02/2018 8:46 PM, Craig Dillabaugh wrote: On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote: On Tue, Feb 06, 2018 at 06:33:02PM +, Ralph Doncaster via Digitalmars-d-learn wrote: clip OO is outdated.  D uses the range-based idiom with UFCS for chaining operations in a

Re: extern(C++) in win32.mak

2018-02-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/02/2018 6:05 AM, Paul D Anderson wrote: I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); That is a string import (-J). What does the word "import" mean in this context? I can't find any

Re: more OO way to do hex string to bytes conversion

2018-02-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/02/2018 4:06 AM, Craig Dillabaugh wrote: On Wednesday, 7 February 2018 at 03:25:05 UTC, rikki cattermole wrote: On 06/02/2018 8:46 PM, Craig Dillabaugh wrote: On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote: [...] clip [...] clip [...] Wouldn't it be more accurate to

Re: What does "(this This)" mean in member function templates?

2018-02-12 Thread rikki cattermole via Digitalmars-d-learn
On 12/02/2018 8:35 AM, Nathan S. wrote: For example in std.container.rbtree: ---     auto equalRange(this This)(Elem e)     {     auto beg = _firstGreaterEqual(e);     alias RangeType = RBRange!(typeof(beg));     if (beg is _end || _less(e, beg.value))     // no values

Re: import strangeness with std.stdio.write

2018-02-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/02/2018 1:46 PM, psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas writeln works just fine as is. - module test; import

Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/02/2018 1:52 PM, psychoticRabbit wrote: On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki cattermole wrote: See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx any idea on how I'd convert this C# code to D? == public

Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/02/2018 12:22 PM, Vino wrote: Hi All,  Request your help on how to get the disk space used and free size of a Network share folder in Windows, tried with getSize but it return 0; eg: Share Name :\\server1\dir1$ From, Vino.B See:

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/02/2018 12:48 PM, Nordlöw wrote: On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole wrote: in pure functions? pure means no globals. As in none :) I don't understand. I thought std.experimental.allocators API was designed to be able express these needs, @andralex?

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/02/2018 12:33 PM, Nordlöw wrote: I'm struggling with making https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d callable in pure functions such as here https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 Shouldn't a shared     static

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 9:21 AM, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after years (since DMD 1 days). A

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:17 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:43 AM, 0x wrote: On Wednesday, 21 February 2018 at 10:24:39 UTC, ketmar wrote: 0x wrote: [...] and that is exactly what slices are for! ;-) you are probably better to use `const(char)[]`, tho. like this: // don't store `s`, as it's contents may change

Re: How to use Com object (it comes from other dll) in D? Thanks.

2018-02-22 Thread rikki cattermole via Digitalmars-d-learn
On 23/02/2018 2:12 AM, FrankLike wrote: Hi,everyone,  I want use the Com object (it comes from other dll) in D,but the core.sys.windows.objidl:QueryInterface Fuction not work. For example: import core.sys.windows.windef; import core.sys.windows.basetyps; import core.sys.windows.uuid; import

Re: Could that bug be catch using D's way?

2018-02-19 Thread rikki cattermole via Digitalmars-d-learn
On 19/02/2018 1:24 PM, Simen Kjærås wrote: On Monday, 19 February 2018 at 12:58:45 UTC, Marc wrote: I'm pretty sure something could be done with Ada's type range but what we could do using D? We can easily define a range type in D. The simple example below probably has awful performance and

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:41 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Re: Lesson 1:Create the DOS Application, Rebuild error: c:\dm\lib\sds.lib(cinit): Previous Definition Different: __Exit ???

2018-06-20 Thread rikki cattermole via Digitalmars-d-learn
This board is for the D programming language. The one you want is https://forum.dlang.org/group/c++

Re: How to best implement a DSL?

2018-07-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/07/2018 2:59 AM, Robert M. Münch wrote: Hi, I'm seeking for ideas/comments/experiences how to best implement a DSL in D. What I would like to do is something like this: ... my D code ... my-dsl {     ... my multi-line DSL code ...     trade 100 shares(x) when (time

Re: How to best implement a DSL?

2018-07-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/07/2018 4:53 AM, Robert M. Münch wrote: On 2018-07-28 15:43:12 +, rikki cattermole said: * Could I somehow call an external program during compilation which gets the DSL block as input and returns D code? No. But you can pre-process. Yes, sure, but this complicates the

Re: Dlangui customize app icon on dock or menu bar

2018-07-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/07/2018 6:13 AM, Jacob Shtokolov wrote: On Wednesday, 25 July 2018 at 09:42:00 UTC, Ivo wrote: I'm a macOs user and I need to build a application with a GUI. Not sure if the author of the DLangUI is visiting this forum so often to be able to answer. If you won't get an answer in the

Re: Linking to dynamic druntime with dub

2018-07-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic druntime with dub? The same way you do it without dub. Except you pass the flags inside of "dflags".

Re: Linking to dynamic druntime with dub

2018-07-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/08/2018 2:18 AM, Nicholas Wilson wrote: On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole wrote: On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? Specs are a bit lite on abstract classes. Only thing I found that would need to allow this is: "19.4 functions without bodies"

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 11:12 AM, ag0aep6g wrote: On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when you compiled. [...]

Re: getopt defaultGetoptPrinter is not safe. Is there a reason for that?

2018-08-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/08/2018 8:32 PM, Markus wrote: On Friday, 17 August 2018 at 08:09:52 UTC, Markus wrote: I wonder what's the reason for that? I wonder why it's not at least @trusted. Literally, can't I trust that method/function? It honestly looks like a simple case of nobody has yet bothered to do

Re: How to declare static compile-time assoc array inside struct?

2018-08-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/08/2018 11:38 PM, Andrey wrote: Hello, I need to declare a static compile-time assoc array inside struct:     struct Test     {     enum Type : ubyte     {     One,     Two,     Three     }     static immutable string[Type] DESCRIPTION =

Re: templated lambda with {} cause GC

2018-08-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/08/2018 9:57 PM, learnfirst1 wrote: import core.stdc.stdio; struct Test { string name ; } void T(alias pred, A...)(){ __gshared t = Test(A) ; pred(t); } extern(C) void main(){ T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test") ; // build OK T!(t

<    2   3   4   5   6   7   8   9   10   11   >