Re: Why are 2-D arrays reversed?

2018-10-10 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 10 October 2018 at 13:22:41 UTC, Chris Katko wrote: int[][] data = [ [1, 0, 1, 0, 0], [1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 0, 0, 1, 0], [5, 1, 1, 1, 0] ]; when drawn with data[i][j], pr

Re: LDC2 -I option results in unresolved externals

2018-10-12 Thread Mike Parker via Digitalmars-d-learn
On Friday, 12 October 2018 at 06:01:12 UTC, spikespaz wrote: I'm using the latest LDC2 beta, and when running the compiler with -I (Look for imports also in ) it fails with unresolved externals. These are my commands. = $ ldc2 "source\setup.

Re: Noob question about structs allocation

2018-10-15 Thread Mike Parker via Digitalmars-d-learn
On Monday, 15 October 2018 at 04:14:24 UTC, IM wrote: What is the effect of calling destroy? - calling the destructor? - deallocating the memory? - both? It calls the destructor. The GC will deallocate the object's memory later. However, you need to be careful about how you use GC-allocated

Re: Why is dynamic array length required here?

2018-10-18 Thread Mike Parker via Digitalmars-d-learn
On Friday, 19 October 2018 at 02:04:37 UTC, Samir wrote: I would have thought that since this is a dynamic array, I don't need to pre-assign its length. Thanks Just to expand on the previous answers, a dynamic array declaration with no initializer is an empty array: int[] arr; assert(ar

Re: DirectX bindings

2018-10-30 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 10:30:48 UTC, John Burton wrote: I want to do some graphics using direct3d11 on windows. There are some bindings that I used once before https://github.com/evilrat666/directx-d However they are marked as [discontinued] While I'm sure they will continue to work so

Re: Exception slipping through the catch block?

2018-11-08 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote: On Thursday, 8 November 2018 at 15:41:11 UTC, Adam D. Ruppe wrote: On Thursday, 8 November 2018 at 15:08:40 UTC, helxi wrote: Shouldn't the catch block in the function catch the exception? You caught Exception, but it throws Error. Th

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 November 2018 at 19:06:56 UTC, Dennis wrote: On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: [...] I just noticed in the section about the static version: "This requires the GLFW development package be installed on your system at compile time." http://code.dlang.org/pa

Re: linker warnings and errors with bindbc-glfw

2018-11-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote: Both work, albeit with a lot of warnings: libcmt.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library glfw3.lib(init.c.obj) : warning LNK4217: locally defined symbo

Re: Why is stdio ... stdio?

2018-11-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 November 2018 at 10:10:37 UTC, bauss wrote: I just want to say everyone who doesn't use the web-interface has to look at markdown anyway because people still write code in backticks etc. despite no support; even I do that. Me, too. It's easy and unobtrusive. As for actually re

Re: How does calling function pointers work?

2018-11-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:29:24 UTC, helxi wrote: Looks like worker needs an int and spawn(&worker, i * 10) seems to feed it's second arg to worker(?) spawn is a template that takes a function pointer and a variable number of parameters. Both the pointer and the parameters are pa

Re: D is supposed to compile fast.

2018-11-25 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 November 2018 at 22:00:21 UTC, Chris Katko wrote: So 1) I have to compile manually, then link. Except that also runs the files every time even if they're up-to-date. Is that normal behavior for C/C++? Yes, C and C++ compilers behave the same way. #1 How to I only build file

Re: dip1000 rule 5

2018-11-25 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 November 2018 at 21:22:09 UTC, sclytrack wrote: Did DIP1000 go through any review process? I'm seeing it is a draft. The previous DIP manager marked DIPs as Draft while they were under review. I don't use that anymore. I left DIP1000 untouched after I took over, however. Walt

Re: dip1000 rule 5

2018-11-27 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 27 November 2018 at 08:56:47 UTC, sclytrack wrote: --- How is a person able to understand this DIP? ./dmd -betterC -dip1000 test.d I'll repeat: the DIP does not currently match the implementation. I was not involved in any of it and have no idea what the diff actually is. Walt

Re: How may I tell dub where to find a C library for linking?

2018-12-10 Thread Mike Parker via Digitalmars-d-learn
On Monday, 10 December 2018 at 15:38:24 UTC, Pab De Nápoli wrote: 1) Setting the LD_LIBRARY_PATH environment variable with export LD_LIBRARY_PATH=/usr/lib/llvm-6.0/lib/ and using "libs" : ["LLVM-6.0"] in dub.json. (this is somewhat nasty, it would be nice to keep all the information toget

Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 17 December 2018 at 06:08:58 UTC, Jani Hur wrote: Publish dates are 2014 and 2015. How much the language has changed/evolved since then and how much it will evolve in future ? So are these books relevant today and still next two years ? There haven't been any changes in the lang

Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 16 December 2018 at 22:02:44 UTC, bachmeier wrote: Sometimes Packt has sales and you can get them pretty cheap. All Packt ebooks are on sale for $5 right now, so this is a great time to pick up both books along with Kai's Vibe.d book.

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 14:46:15 UTC, Ron Tarrant wrote: I've found a ton of syntax highlighter plugins for WordPress, but none that admit to supporting D. Anyone know of one? Or, short of that, perhaps a different site build/management tool (read: not WordPress) with decent D syntax hig

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 20:27:44 UTC, Ron Tarrant wrote: On Tuesday, 1 January 2019 at 18:10:49 UTC, Mike Parker wrote: We're using Mivhak Syntax Highlighter on the D Blog. OOTB, or...? I couldn't find a list of supported languages. It supports D out of the box.

Re: Compile time opAssign/@property constraints

2019-01-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 January 2019 at 11:53:41 UTC, Jacob Shtokolov wrote: On Friday, 4 January 2019 at 11:45:24 UTC, Jacob Shtokolov wrote: Here is the simple example: https://run.dlang.io/gist/1a06dd703bea5548ee72b4713a7ce5f6 Sorry, invalid link. Here is a new one: https://run.dlang.io/is/QZ5hLV

Re: Co-developing application and library

2019-01-05 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 5 January 2019 at 13:01:24 UTC, Russel Winder wrote: Dub seems to have the inbuilt assumption that libraries are dependencies that do not change except via a formal release when you developing an application. Clearly there is the workflow where you want to amend the library but not

Re: Co-developing application and library

2019-01-05 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 5 January 2019 at 15:17:28 UTC, Mike Parker wrote: On Saturday, 5 January 2019 at 13:01:24 UTC, Russel Winder wrote: Dub seems to have the inbuilt assumption that libraries are dependencies that do not change except via a formal release when you developing an application. Clearly t

Re: Libraries, versions, API changes, and Dub

2019-01-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 January 2019 at 05:44:22 UTC, Russel Winder wrote: It appears that libdvbv5 has undergone an (unnoticed by me till just now) version change. This raises a general question for creators of D bindings. libdvbv5 has versions 1.12.x, 1.14.x, 1.16.x, etc, following the "odd is inte

Re: Libraries, versions, API changes, and Dub

2019-01-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 January 2019 at 10:28:55 UTC, Mike Parker wrote: to set up compile-time versions Compile-time *values* else enum dvbvSupport = DVBVSupport.v114; This, of course, should be = DVBVSupport.v112

Re: Interfacing with C libs: weeding through C/C++ macros and such in header files

2019-01-13 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 January 2019 at 22:40:57 UTC, Alec Stewart wrote: Example without code; for some reason a macro is defined for the stdlib functions `malloc`, `realloc`, and `free`. Maybe it's just because I don't have any pro experience with C or C++, but that seems a bit excessive. Or I could

Re: How to disable/hide constructor when using factory method?

2019-01-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 January 2019 at 12:58:15 UTC, JN wrote: Doh. Of course. I feel so dumb. I just had it at @disable this();, then replaced @disable with private without thinking to add {} Give me a nickel for every time I've made an edit like that...!

Re: Linux & DMD & GtkD

2019-02-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 February 2019 at 13:35:57 UTC, Ron Tarrant wrote: dmd -de -w -m64 -L+gtkd hello_gtkd_world.d DMD's -L switch means "pass the following flag to the linker". Linker arguments are system-dependent. The + is what you use on Windows to specify the library path when running DMD w

Re: Is there a way to replace Exception with as a macro in C?

2019-02-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 06:16:59 UTC, Mike Parker wrote: ``` Exception invalidIndexException() { throw new Exception("Index is invalid"); } Eh, that should be: void invalidIndexException() {...}

Re: Is there a way to replace Exception with as a macro in C?

2019-02-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 05:50:04 UTC, yisooan wrote: This is allowed. But I want to do the exact same thing in D. I have already tried some expressions with alias? but it doesn't work. alias can't be used for expressions. Would you help me, please? There's nothing exactly equiv

Re: Next steps of approved DIPs

2019-02-20 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 20 February 2019 at 11:52:35 UTC, Peter Particle wrote: In particular I am interested in DIP 1014 but this question can be applied to any approved DIP. Where do I get information about e.g. implementer, implementation state/progress, which DMD version is expected to include it (ap

Re: Why is SwitchError an error and how is it unsafe to continue after catching it?

2019-02-24 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 February 2019 at 10:53:09 UTC, aliak wrote: Because from what I understand, an Error is something you should not be catching and represents something unrecoverable. And it the docs say that it's unsafe to continue execution. But the following code is very recoverable and I don't s

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 02:13:30 UTC, evilrat wrote: This should do for MS linker "lflags-windows-x86_64": ["/SUBSYSTEM:CONSOLE"], "lflags-windows-x86_mscoff": ["/SUBSYSTEM:WINDOWS"] For old optlink x86 it is a bit harder, you need to include special .def file that has instruction

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Monday, 4 March 2019 at 18:34:09 UTC, Robert M. Münch wrote: Hi, when compiling a minimal Windows GUI app (using WinMain()) and compiling it with DUB, the 32-bit x86 version is a character subsystem EXE (writeln works) and for x86_64 it's a GUI subsystem EXE (writeln doesn't work). Since com

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 04:32:57 UTC, evilrat wrote: On Tuesday, 5 March 2019 at 03:48:22 UTC, Mike Parker wrote: I stopped using WinMain with D a long time ago. It's not necessary. If you always use `main`, then both linkers will provide you with a console subsystem app by default. That's

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 07:10:51 UTC, Robert M. Münch wrote: t. My missing point was, that I didn't expect to work with two different links. And I totally agree, DUB needs to mention this. Make everyones live easy. I don't want to dig through fragmented information, collect and sort all p

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 07:25:40 UTC, Mike Parker wrote: documentation. Instead, it belongs in the DMD windows documentation. It's currently missing: https://dlang.org/dmd-windows.html#linking The 32-bit COFF support is missing there I mean. It does specifically mention that there are d

Re: Templates - What's Up with the template keyword?

2019-04-08 Thread Mike Parker via Digitalmars-d-learn
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote: First, the question... In Michael Parker's book, "Learning D," (Packt, 2015) on page 160 he gives an example of a basic template: template MyTemplate(T) { T val; void printVal() { import std.stdio : writeln; wr

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 10:53:49 UTC, Ron Tarrant wrote: On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote: In the subsequent sections, I show both long and short (eponymous) forms of enum and function templates. In your book, Mike, you stated: Remember, a template is only insta

Re: bug in compiles?

2019-04-11 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 11 April 2019 at 22:41:32 UTC, Alex wrote: Seriously? Do you think you have ESP? Your code isn't even close to was talking about ;/ Here is is updated that shows the error. You seem to fail to understand that it is impossible for it to be my code. If you continue to attack pe

Re: Anyone have a Vibe.d Diet Template syntax definition for Sublime?

2019-04-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 April 2019 at 04:12:11 UTC, Andrej Mitrovic wrote: Or perhaps for any other editor so I could adapt it and have syntax highlighting in Sublime when viewing .dt files. Bot dls and code-d have VS Code syntax files for diet templates: https://github.com/d-language-server/vscode-dlan

Re: Check if function argument can be handled in CT

2019-04-24 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 24 April 2019 at 10:52:58 UTC, Andrey wrote: On Wednesday, 24 April 2019 at 08:28:06 UTC, Basile.B wrote: On Wednesday, 24 April 2019 at 07:53:47 UTC, Andrey wrote: I know about this template. Unfortunally, it doesn't work inside functions. void test(string arg1, string arg2) {

Re: DMD different compiler behaviour on Linux and Windows

2019-04-25 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 25 April 2019 at 20:18:28 UTC, Zans wrote: import std.stdio; void main() { char[] mychars; mychars ~= 'a'; long index = 0L; writeln(mychars[index]); } Why would the code above compile perfectly on Linux (Ubuntu 16.04), however it would produce the following error o

Re: DMD different compiler behaviour on Linux and Windows

2019-04-26 Thread Mike Parker via Digitalmars-d-learn
On Friday, 26 April 2019 at 15:48:51 UTC, Ron Tarrant wrote: On Thursday, 25 April 2019 at 20:38:31 UTC, Mike Parker wrote: If you compile with -m32 on Windows the error goes away. Not trying to be a but it also works with -m64 on Windows. Yes, thanks. That's a typo. -m32, where size_t is

Re: Packages / imports & references between modules

2019-04-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 28 April 2019 at 11:12:50 UTC, Robert M. Münch wrote: One more problem now showing up, when I do this: A/a.d module A.a; struct myStruct; A/b.d module A.b; struct myStruct {...} A/c.d module A.c; import A; struct myOtherStruc

Re: dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 2 May 2019 at 22:54:20 UTC, Joshua Hodkinson wrote: Hi everyone, I am getting a linker error when compiling with dmd (v2.085.1) when using StrechDIBits from the win32 api. Error 42: Symbol Undefined _StretchDIBits@52 However with ldc (v1.15.0) the program compiles correctly. Wo

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Mike Parker via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: What is the correct way? --DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of th

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 07:13:44 UTC, Rnd wrote: I know 'new' is not needed to create instances of structs but can one use 'new'? Yes. It can be used with any value type to allocate a block of memory on the GC heap and return a pointer to that memory: struct Foo { ... } Foo* f = new Foo

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote: If yes, when should one use 'new'? Whenever you need to allocate something from the GC heap. In my experience, it's rare to need it with value types in D. I tend to use it primarily with classes and arrays. Ali's book has an examp

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:50:46 UTC, Mike Parker wrote: On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote: If yes, when should one use 'new'? Whenever you need to allocate something from the GC heap. In my experience, it's rare to need it with value types in D. I tend to use it

Re: Why after writeln the binaryHeap become empty?

2019-06-18 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 06:00:28 UTC, Jonathan M Davis wrote: On Tuesday, June 18, 2019 10:27:46 PM MDT lili via Do you known reason for why Dlang Range are consumed by iterating over them. I this design is strange. If you want an overview of ranges, you can watch this: https://www.

Re: dub + local dependencies

2017-07-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 15:34:36 UTC, Jolly James wrote: WARNING: A deprecated branch based version specification is used for the dependency xyz. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a br

Re: dub + local dependencies

2017-07-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 00:09:46 UTC, Mike Parker wrote: You have a few options: * Use a path dependency: "dependencies": { "xyz": { "path": "path/to/xyz" } } * Use add-local with a version on the command line: dub add-local path/to/xyz 0.0.1 * Use add-local or add-

Re: AutoDLL

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 12:15:57 UTC, FoxyBrown wrote: //pragma(lib, "portaudio_x86.lib"); // Doesn't work because libs are invalid Probably just a OMF/COFF issue. If you try to link with a COFF library while compiling with 32-bit DMD in its default configuration on Windows, you'll get

Re: AutoDLL

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 16:14:18 UTC, Mike Parker wrote: to compile with -m32mscoff MS linker instead. Either that, or *to use* the MS linker

Re: Need simple sound

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 17:33:49 UTC, FoxyBrown wrote: I think the autoDLL if done right. I hacked it together and worked easier than I thought but didn't put in the time to make it nice. It could avoid libs all together, not that we need to do that. Still need a h/di file, of course.

Re: rdmd vs dmd WRT static constructors

2017-07-08 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 9 July 2017 at 02:57:54 UTC, Andrew Edwards wrote: $ rdmd statmain.d stat1.d stat2.d // outputs nothing... Bug or intended behaviour? rdmd takes the first D file you give it, follows its import tree, and compiles all the modules found there. Anything on the command line after

Re: Why no offsetof for static struct?

2017-07-10 Thread Mike Parker via Digitalmars-d-learn
On 7/11/2017 6:14 AM, FoxyBrown wrote: On Monday, 10 July 2017 at 20:13:46 UTC, Adam D. Ruppe wrote: No, it isn't. Static members are stored in an entirely different place than non-static members. They are really just global variables in memory with their in-source name being nested somewhere

Re: ddox filters out my doc

2017-07-15 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 15 July 2017 at 08:29:52 UTC, Jean-Louis Leroy wrote: My module has a name in dub.sdl. No, it does not. That's the name of the DUB project. The module in this case is source/methods.d. I've never used ddox, but based on what I see in the readme and on looking at the ddox source

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 11:52:09 UTC, John Burton wrote: lib1.d private void init() { // init function used only as an implementation detail } void mything() { init(); } lib2.d - void init() { // init function meant to be used as part of the module inte

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 12:11:38 UTC, John Burton wrote: On Wednesday, 19 July 2017 at 12:05:09 UTC, Kagamin wrote: Try a newer compiler, this was fixed recently. Hmm it turns out this machine has 2.0.65 on which is fairly ancient. I'd not realized this machine had not been updated. S

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 12:16:46 UTC, John Burton wrote: Looks like it's https://wiki.dlang.org/DIP22 that changed this Specifically, it was fixed in DMD 2.071.0 released in April of last year: http://dlang.org/changelog/2.071.0.html#dip22

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same metho

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:11:27 UTC, Mike Parker wrote: On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many exa

Re: VibeD - undefinded identifier

2017-07-23 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 23 July 2017 at 15:23:25 UTC, holo wrote: this(auto tmp) You need to specify a type here instead of using auto.

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 12:40:13 UTC, John Burton wrote: I can create a "slice" using non-gc allocated memory. int* ptr = cast(int*)calloc(int.sizeof, 10); int[] data = ptr[0..10]; If I don't want a memory leak I have to call free(ptr) somewhere as it won't be GC collected

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: Static Arrays have property .sizeof which returns the array length multiplied by the number of bytes per array element. Dynamic Arrays have property .sizeof which returns the size of the dynamic array reference, which is 8 in 32-

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 16:27:57 UTC, WhatMeWorry wrote: On Wednesday, 26 July 2017 at 02:31:33 UTC, Mike Parker wrote: With static arrays, the memory for the elements if part of the array itself, so it is counted in the size. For dynamic arrays, it is not. For .sizeof to report the size

Re: It makes me sick!

2017-07-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 00:28:52 UTC, FoxyBrown wrote: You are not being very logical. The zip file as N files in it. No matter what those files are, it should be a closed system. That is, if I insert or add(not replace) M file to the directory structure it should not break D, period! T

Re: It makes me sick!

2017-07-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 12:48:37 UTC, Grander wrote: On Friday, 28 July 2017 at 12:40:27 UTC, rjframe wrote: On Fri, 28 Jul 2017 05:14:16 +, FoxyBrown wrote: You can make any claim you want like: "The end user should install in to a clean dir so that DMD doesn't get confused and load

Re: It makes me sick!

2017-07-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 13:39:42 UTC, Arafel wrote: I know this page is not the MAIN "download" [2] page, but it's both reached from the "About" link, and as the first google hit for "dlang download windows", so it should be kept as up to date as possible. [1]: https://dlang.org/dmd-win

Re: How a class can know the current reference of itself?

2017-08-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 August 2017 at 09:38:59 UTC, Pippo wrote: I'm trying to do something like this: module mylib.classA; class A { @property string myproperty; void function(ref A a) callToMyFunction; void myfunction() { callToMyFunction(ref this); } } module

Re: How a class can know the current reference of itself?

2017-08-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 August 2017 at 09:58:34 UTC, Mike Parker wrote: Also, class references are *already* references, so you don't need to declare the function parameters as ref. Finally, although this is not an error, @property has no effect on member variables. It only applies to member functions. A

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 16:23:01 UTC, bitwise wrote: So I guess you're saying I'm covered then? I guess there's no reason I can think of for the GC to stop scanning at the language boundary, let alone any way to actually do that efficiently. It's not something you can rely on. If the poi

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 17:16:05 UTC, bitwise wrote: I was referring specifically to storing gc_malloc'ed pointers on the stack, meaning that I'm calling a C++ function on a D call stack, and storing the pointer as a local var in the C++ function before returning it to D. The more I th

Re: Constructor is not callable using argument types

2017-08-07 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 06:03:06 UTC, Nrgyzer wrote: Hi guys, I've the following code: abstract class a {} class b : a { this(a* myAttr = null) {} } class c : a { this(a* myAttr = null) {} } void main() { auto myb = new b(); auto myc = new c(&myb); } DMD says "Constructor c.this(

Re: DlangUI Error

2017-08-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 August 2017 at 23:38:42 UTC, Jiyan wrote: So the strange thing is i had an older compiler (v2.074.1), so i started running the 2.075 version - with which it worked! The thing is i can start the 2.075 version only over the activate.sh script in a shell. Can you tell me how i can

Re: std.range.put vs R.put: Best practices?

2017-08-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 August 2017 at 18:08:27 UTC, Jon Degenhardt wrote: Documentation for std.range.put (https://dlang.org/phobos/std_range_primitives.html#.put) has the intriguing line: put should not be used "UFCS-style", e.g. r.put(e). Doing this may call R.put directly, by-passing any transforma

Re: DerelictGL3 reload crashes in 32 builds

2017-08-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 August 2017 at 19:29:55 UTC, Igor wrote: In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes. Using LDC debug build I managed to find that it crashes after executing ret instruction from bindGLFunc in glloader. If someo

Re: DerelictGL3 reload crashes in 32 builds

2017-08-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 August 2017 at 02:40:59 UTC, Mike Parker wrote: On Sunday, 20 August 2017 at 19:29:55 UTC, Igor wrote: In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes. Using LDC debug build I managed to find that it crashes after e

Re: Long File path Exception:The system cannot find the path specified

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 05:06:50 UTC, Vino.B wrote: Hi All, When i run the below code in windows i am getting "The system cannot find the path specified" even though the path exist , the length of the path is 516 as below, request your help. Path : N:\PROD_TEAM\TST_BACKUP\abcyf0\TS

Re: DerelictGL3 reload crashes in 32 builds

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 16:54:24 UTC, Igor wrote: On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: On Monday, 21 August 2017 at 12:38:28 UTC, Mike Parker wrote: Have you tried to compile outside of VisualD? Hmmm... I though I tried running with just typing dub which should use

Re: DerelictGL3 reload crashes in 32 builds

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: In the meantime can you tell me these two things: 1. How come DerelictGLES only has: static if( Derelict_OS_Windows ) ... else static if( Derelict_OS_Posix && !Derelict_OS_Mac )... when GLES is primarily intended for mobile platforms as fa

Re: D Code to html

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 20:03:16 UTC, Andre Pany wrote: Hi, how does the D syntax highlighting in e.g. https://dlang.org/blog/2017/08/23/d-as-a-better-c/ works? From reading the html source code I understand there is some functionality prettyprint but not how it is included and what

Re: No CTFE of function

2017-08-27 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 27 August 2017 at 17:47:54 UTC, Cecil Ward wrote: I wonder if there is anything written up anywhere about what kinds of things are blockers to either CTFE or to successful constant-folding optimisation in particular compilers or in general? Would be useful to know what to stay aw

Re: General performance tip about possibly using the GC or not

2017-08-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 29 August 2017 at 00:52:11 UTC, Cecil Ward wrote: I am vacillating - considering breaking a lifetime's C habits and letting the D garbage collector make life wonderful by just cleaning up after me and ruining my future C disciple by not deleting stuff myself. It's not a panacea, b

Re: C callbacks getting a value of 0! Bug in D?

2017-08-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 29 August 2017 at 01:34:40 UTC, Johnson Jones wrote: import core.stdc.config; pragma(msg, c_long.sizeof); prints 4UL both on x64 and x86 and and C: void foo() { int dummy; switch (dummy) { case sizeof(long) : case sizeof(long) : bre

Re: DIPs - question about mores, etiquette and DIP1009 in particular

2017-08-30 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 17:16:11 UTC, Cecil Ward wrote: Is there a way I can simply register my vote eg about DIP 1009? My vote is 'no thanks'. Like the existing system, don't care about the alleged verbosity / room thing, and please whatever do not deprecate the existing syntax because

Re: DIPs - question about mores, etiquette and DIP1009 in particular

2017-08-30 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 22:50:22 UTC, Cecil Ward wrote: On Wednesday, 30 August 2017 at 22:09:21 UTC, Mike Parker wrote: On Wednesday, 30 August 2017 at 17:16:11 UTC, Cecil Ward wrote: DIPs are not voted on. Thanks for letting me know, answers my question. Our leaders would perhaps f

Re: 24-bit int

2017-09-01 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 2 September 2017 at 01:19:52 UTC, EntangledQuanta wrote: The whole point is so that there is no wasted space, so if it requires that then it's not a waste of space but a bug. Audio that is in24 is 3 bytes per sample, not 4. Every 3 bytes are a sample, not every 3 out of 4. Bas

Re: 24-bit int

2017-09-02 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 2 September 2017 at 07:20:07 UTC, kinke wrote: struct int24 { ubyte[3] _payload; } static assert(int24.sizeof == 3); static assert(int24.alignof == 1); Making absolute sense. ubytes don't need any specific alignment to be read efficiently. Yes, that does make sense. It does

Re: Ranges seem awkward to work with

2017-09-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote: Is this is a common beginner issue? I remember using an earlier version of D some long time ago and I don't remember seeing this concept. Now, a lot of library functions seem to expect ranges as inputs and return ranges as outpu

Re: DerelictGL3 slow compilation speed with contexts

2017-09-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 21:55:23 UTC, Igor wrote: Hi All, I switched from using free functions in DerelictGL3 to DerelictGL3_Contexts and compilation speed in optimized build using DMD went from 2 seconds to 7 minutes and using LDC from 2 seconds to 10 seconds. Is this a known proble

Re: DerelictGL3 slow compilation speed with contexts

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 10:28:26 UTC, Igor wrote: Well since minimal example is a window app that opens a window, sets everything up and calls opengl stuff I will just push it to my github project this evening and you will can try with that. I will let you know when its done. In t

Re: failed loading freetype 2.6 via derelict-ft

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 19:01:52 UTC, Spacen wrote: Hello, I am trying to resurect an old project, but can't get the freetype library loaded. I can't figgure out what to do it's been a while. I have just built the freetype 2.6 library with visual studio 2015. Any tips would be appr

Re: failed loading freetype 2.6 via derelict-ft

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 20:16:23 UTC, Igor wrote: Make sure dll is also 32bit if you are building 32bit app and your Visual Studio should have dumpbin utility which you can use to make sure the required symbols are properly exported: dumpbin /EXPORTS your.dll In that case, he'd ha

Re: DerelictGL3 slow compilation speed with contexts

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 16:30:34 UTC, Igor wrote: I tested it again with my entire project and it seems it is not inline thing but -O (optimized build). You can checkout the project here: https://github.com/igor84/dngin if you try to build it with "dub build -ax86_64 -b release"

Re: failed loading freetype 2.6 via derelict-ft

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 22:18:07 UTC, Mike Parker wrote: Missing symbols usually mean a version mismatch. The latest DerelictFT requires FreeType 2.6 or later. It could also mean your shared library was compiled without bzip2 support. I'm on my phone right now else I'd check it m

Re: failed loading freetype 2.6 via derelict-ft

2017-09-15 Thread Mike Parker via Digitalmars-d-learn
On Friday, 15 September 2017 at 16:04:52 UTC, Spacen wrote: Thanks for the reply that is exactly it. I downloaded several dlls from the internet, and then decided to build it myself. I see there is a bzip configuration option but I'll need to read the documentation and presumably bzip gets lin

Re: extern(C) enum

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote: On Sunday, 17 September 2017 at 18:44:47 UTC, nkm1 wrote: On Sunday, 17 September 2017 at 17:06:10 UTC, bitwise wrote: [...] Just put the burden on the users then. It's implementation defined, so they are in position to figure it o

Re: Looking for instructions on how to make a Derelict library

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 September 2017 at 21:15:08 UTC, Matt Jones wrote: Hey everyone, I wanted to make a version of SQlite3 that uses Derelict to load the sqlite3 DLL when I'm ready. I can't find any instructions for how to make a basic Derelict style library. I looked around at http://derelictorg.gi

Re: extern(C) enum

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 September 2017 at 02:04:49 UTC, bitwise wrote: On Monday, 18 September 2017 at 00:12:49 UTC, Mike Parker wrote: On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote: [...] I've been maintaining bindings to multiple C libraries (including Freetype 2 bindings) for 13 years

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