Precision Error?

2024-10-06 Thread WhatMeWorry` via Digitalmars-d-learn
float computeToFitInWindow(uint rows, uint cols) { // code removed ... writeln(hexWidth); return hexWidth; } unittest { assert(computeToFitInWindow(1, 1) == 2.0f, "This assert failed"); assert(computeToFitInWindow(3, 3) == 0.8f, "This

Re: 12 line program... `main` is a nested function when trying to use redblacktree. Beginner error???

2024-06-27 Thread WhatMeWorry via Digitalmars-d-learn
Thanks, that did the trick. Not sure why having the declarations at global scope (or is it module scope in D) would work versus having them at local scope?

12 line program... `main` is a nested function when trying to use redblacktree. Beginner error???

2024-06-27 Thread WhatMeWorry` via Digitalmars-d-learn
import std.container : RedBlackTree; int main() { struct Location { int x; int y; } struct Node{ this(Location loc, uint f) { this.loc = loc; this.f = f; } Location loc; uint f; } auto priorityQueue = new R

Anybody know about SDL and particularly SDL_TTF initialization?

2024-05-12 Thread WhatMeWorry` via Digitalmars-d-learn
This should be trivial, right? I've been looking at existing D repo code for hours. Can't figure why TTF_Init doesn't work? It would help if I could figure out how to use SDL_GetError() INFO: SDL loaded v2.30.2 INFO: SDL initialized: 0 INFO: TTF loaded: v2.0.14 Error Program exited with code -1

What I thought was straightforward blew up in my face..

2024-04-10 Thread WhatMeWorry via Digitalmars-d-learn
import bindbc.sdl; import bindbc.loader; SDL_version ver; SDL_GetVersion(&ver); writeln("version = ", ver); // runs and displays: version = SDL_version(2, 30, 2) writeln("version = ", SDL_GetVersion(&ver)); // compile fails with // template `wr

How to resolve two packages requiring different versions of another package?

2024-04-04 Thread WhatMeWorry via Digitalmars-d-learn
Error: Unresolvable dependencies to package bindbc-loader: bindbc-opengl 0.13.0 depends on bindbc-loader ~>0.3.0 bindbc-sdl 1.4.7 depends on bindbc-loader ~>1.1.0

Boneheaded question regarding compilation...

2024-04-01 Thread WhatMeWorry via Digitalmars-d-learn
Huge fan of Mike Shah's YouTube videos regarding D and his latest for D conference: https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf So I installed github desktop app and cloned his Talks repo. There is a build command commen

At D-Conf, Mike Shah's students presented a project. Is it in GitHub? Cant find it.

2023-09-22 Thread WhatMeWorry via Digitalmars-d-learn
Wanted to study code. I watched the video talk. But i couldn't see any URL etc.. Believe it was called Draw.

Re: quick question, probably of little importance...

2023-04-26 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 26 April 2023 at 23:02:07 UTC, Richard (Rikki) Andrew Cattermole wrote: Don't forget ``num % 2 == 0``. None should matter, pretty much all production compilers within the last 30 years should recognize all forms of this and do the right thing. Thanks. Fastest reply ever! And I

quick question, probably of little importance...

2023-04-26 Thread WhatMeWorry via Digitalmars-d-learn
I just need an even/odd functionality. Don't think D has a built-in operator. // Found this C code online. int isEven(int num) { return !(num & 1); } // found this in std.functional.unaryFun alias isEven = unaryFun!("(a & 1) == 0"); assert(isEven(2) && !isEven(1)); If int

Re: Watch me beat a dead horse. Super simple program...

2023-03-22 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 22 March 2023 at 21:08:23 UTC, Richard (Rikki) Andrew Cattermole wrote: I finally went ahead and looked at the dependencies of FreeImage3180. Try installing: https://www.microsoft.com/en-ca/download/details.aspx?id=48145 It requires VCOMP140.dll which comes with the 2015 VC re

Watch me beat a dead horse. Super simple program...

2023-03-22 Thread WhatMeWorry via Digitalmars-d-learn
Ok, I've gotten rid of dub and dub packages code. Just LoadLibraryA. All eight dlls work except for FreeImage.dll. I've compiled with dmd and -m64 option and freshly download a x64 FreeImage. Any Window users out there that use LoadLibraryA or FreeImage.dll? ``` import std.stdio: writeln; imp

My tiny program still can't get FreeImage.dll to load... GLFW.dll library loads no problem...

2023-03-15 Thread WhatMeWorry via Digitalmars-d-learn
I appreciate all the help people have given me previously. So I've made everything super simple. The dub.sdl file consists of four lines: name "00_03_freeimage_debug" dependency "bindbc-glfw" version="~>1.0.0" dependency "bindbc-freeimage" version="~>1.0.2" versions "FI_318" The app.d use ex

Re: dub.sdl bindbc-glfw is returning a deprecation warming. So what do I do now?

2023-03-09 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 9 March 2023 at 06:36:18 UTC, IchorDev wrote: On Thursday, 9 March 2023 at 00:21:02 UTC, WhatMeWorry wrote: [...] Sorry about that. Try updating to bindbc-glfw 1.0.2, should be fixed now. If you see any other deprecation warnings from BindBC bindings you can silence them with `-

dub.sdl bindbc-glfw is returning a deprecation warming. So what do I do now?

2023-03-08 Thread WhatMeWorry via Digitalmars-d-learn
my small dub.sdl project uses: dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW_33" and returns Building bindbc-glfw 1.0.1: building configuration [dynamic] C:\Users\Admin\AppData\Local\dub\packages\bindbc-glfw-1.0.1\bindbc-glfw\source\bindbc\glfw\binddynamic.d(557,11): Deprecati

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 3 March 2023 at 19:44:17 UTC, ryuukk_ wrote: What happens if you put the dll next to your executable, does it find it? Good idea. I copied the dll into same directory as the executable and changed loadFreeImage to immutable FISupport fiLib = loadFreeImage(); And I get the same no

Can't load FreeImage.dll with Windows

2023-03-03 Thread WhatMeWorry via Digitalmars-d-learn
I've tried distilling the problem to its very essence. I downloaded the FreeImage.dll from https://freeimage.sourceforge.io/download.html to the following directory: where /R c:\ FreeImage.dll c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll dir c:\Users

Re: Dub is not finding the dynamic link library MSVCR120.dll...

2023-02-20 Thread WhatMeworry via Digitalmars-d-learn
On Monday, 20 February 2023 at 01:04:25 UTC, Mike Parker wrote: Any error about a missing DLL is a run-time error that's unrelated to dub or the compiler. Normally, for end users, a missing MSVC runtime DLL means you have to install the MSVC Redistributable package. This version of the DLL yo

Dub is not finding the dynamic link library MSVCR120.dll...

2023-02-19 Thread WhatMeWorry via Digitalmars-d-learn
and is abending with an error saying exactly this. How do I specify the path to this library? Can I use one of the environment variables in sc.ini, one of the Windows env variables, or one of the dub options? Btw, I'm bypassing on purpose the official D installation.

Re: Can't seem to find the relevant documentation for dub.

2022-11-01 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 31 October 2022 at 20:31:11 UTC, ryuukk_ wrote: On Monday, 31 October 2022 at 20:20:49 UTC, WhatMeWorry wrote: I've got a pretty straightforward SDL dub file dependency "bindbc-opengl"version="~>1.0.3" versions "GL_46" dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW

Can't seem to find the relevant documentation for dub.

2022-10-31 Thread WhatMeWorry via Digitalmars-d-learn
I've got a pretty straightforward SDL dub file dependency "bindbc-opengl"version="~>1.0.3" versions "GL_46" dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW_33" dependency "gl3n" version="~>1.4.1" dependency "bindbc-freeimage" version="~>0.1.1" versions "FI_317" Unr

Re: auto scope question?

2022-10-25 Thread WhatMeWorry via Digitalmars-d-learn
typeof(screen.output.findSplit("")) s; Perfect. That was the "essence" of my question. But thanks to Ali, I don't have to use such esoteric syntax. D is a wonderful language, but I seem to shoot myself in the foot :)

auto scope question?

2022-10-25 Thread WhatMeWorry via Digitalmars-d-learn
I'm naturally getting a undefined identifier `s` error in the return. Is there some way to refactor my code? I tried to declare s outside of the else brackets like: auto screen = executeShell(cmdLine); auto s; ... { s = screen.output.findSplit("REG_SZ"); } but that doesn't compile either

Real simple question... for good programmers

2022-10-22 Thread WhatMeWorry via Digitalmars-d-learn
string[] tokens = userSID.output.split!isWhite; writeln("tokens = ", tokens); tokens = ["SID", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "S-1-5-

Can someone tell me what the compiler thought I was trying to do?

2022-10-14 Thread WhatMeWorry via Digitalmars-d-learn
I lost about a half an hour troubleshooting some code of mine which as it turned out to be resolved with just one line. // paths.remove(i); // compiles fine but does nothing paths = paths.remove(i); // works - what I erroneously thought the previous line was doing Is the first line no

probably a trivial question...

2022-10-13 Thread WhatMeWorry via Digitalmars-d-learn
I was a little (nicely) surprised that I could use double quotes, single quotes, or back ticks in the following line of code. return s.split(";"); // double quotes or return s.split(';'); // single quotes or return s.split(`;`); // back ticks Does D provide any guidance as to what is pref

Beginner memory question.

2022-04-16 Thread WhatMeWorry via Digitalmars-d-learn
I'm playing around with dynamic arrays and I wrote the tiny program (at bottom). I get the following output: PS C:\D\sandbox> dmd -m64 maxMem.d PS C:\D\sandbox> .\maxMem.exe Reserving 1,610,613,245 elements reserve() returned a size of: 1,610,613,245 The capacity() of big is 1,610,613,245 ulong.

Good to the last drop.

2022-03-31 Thread WhatMeWorry via Digitalmars-d-learn
I run the program (at the bottom) and get, as expected, the run-time out of memory error: PS C:\D\sandbox> .\Reserve.exe newCapacity = [ 1] newCapacity = [ 3] newCapacity = [ 5] ooo newCapacity = [905,207,293] newCapaci

Basic question about size_t and ulong

2022-03-18 Thread WhatMeWorry via Digitalmars-d-learn
Quoting the D documentation: size_t is an alias to one of the unsigned integral basic types, and represents a type that is large enough to represent an offset into all addressable memory. And I have a line of code: size_t huge = ulong.max; dmd GC.d GC.d(29): Error: cannot implicitly convert

Embarrassed to ask this question because it seems so trivial but genuinely curious...

2022-01-27 Thread WhatMeWorry via Digitalmars-d-learn
While studying Ali's book at chapter "Constructor and Other Special Functions" and the below code snippet: import std.stdio; struct S { this(int i) { writeln("an object"); } // Original //this(int i) const { writeln("a const object"); } //this(int i) immuta

Re: Name mangling problem with tiny Windows 10 load-time DLL example

2021-02-28 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 28 February 2021 at 22:10:21 UTC, Siemargl wrote: On Sunday, 28 February 2021 at 18:29:11 UTC, WhatMeWorry wrote: It seems pretty obvious the problem is with name mangling. But how to fix it? fixing int numb = 1; and your example work correct ldc 1.24 / win10 P.S.I'm not re

Name mangling problem with tiny Windows 10 load-time DLL example

2021-02-28 Thread WhatMeWorry via Digitalmars-d-learn
It seems pretty obvious the problem is with name mangling. But how to fix it? -- module file; extern(D) export { int addOne(int i) { return (i + 1); } } -- module p

Re: Real simple unresolved external symbols question...

2021-02-10 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 11:38:00 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 9 February 2021 at 19:37:17 UTC, WhatMeWorry wrote: I'm trying to create a super simple dynamic library consisting of two files: [...] remove /NOENTRY, and include "mixin SimpleDllMain;" in one of the sour

Real simple unresolved external symbols question...

2021-02-09 Thread WhatMeWorry via Digitalmars-d-learn
I'm trying to create a super simple dynamic library consisting of two files: file2.d -- extern(D): double addEight(double d) { return (d + 8.0); } fileB.d -- extern(D) { string concatSuffix(string s) { return

What is the difference between static linking with .a and .so libphobos?

2021-02-02 Thread WhatMeWorry via Digitalmars-d-learn
I'm studying the D article at: https://dlang.org/articles/dll-linux.html#dso5 https://dlang.org/articles/dll-linux.html#dso6 Statically Linking D Program With libphobos2.a Statically Linking D Program With libphobos2.so Don't we want to Dynamically link with shared libphobos2.so? Also why do

What does this code snippet even do?

2021-01-29 Thread WhatMeWorry via Digitalmars-d-learn
// The following four lines in run.lang.io int[] a; alias T = long; pragma(msg, is(typeof(a) : U[], U : T)); pragma(msg, is(typeof(a) : T[])); // returns true false But I'm not even sure what I'm looking at. Ali's book talks about the colon appearing for :, associative array ⬁ :, import

real beginner question about D's web site?

2021-01-24 Thread WhatMeWorry via Digitalmars-d-learn
https://github.com/dlang/dlang.org/blob/ff235feedcb2bcb73ba348dcd1763542a43c7778/doc.ddoc D_S = $(LAYOUT ,$1,$(ARGS $+)) SPEC_S = $(LAYOUT ,$1,$(ARGS $+)) COMMUNITY= $(LAYOUT ,$1,$(ARGS $+)) _= LAYOUT=$3 _= I realize that D_S and LAYOUT, etc are macros. I've read the DDoc documentation

Re: D static library on Windows 64 problem

2021-01-03 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 3 January 2021 at 15:49:03 UTC, Imperatorn wrote: On Saturday, 2 January 2021 at 22:08:34 UTC, WhatMeWorry wrote: On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote: I'm stepping through the windows static library tutorial at http://prowiki.org/wiki4d/wiki.cgi?D__Tutoria

Re: D static library on Windows 64 problem

2021-01-02 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote: I'm stepping through the windows static library tutorial at http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually [...] Oops. used the manual example. Should be /LIBPATH:c:\dev\LibraryStudy\StaticLibr

D static library on Windows 64 problem

2021-01-02 Thread WhatMeWorry via Digitalmars-d-learn
I'm stepping through the windows static library tutorial at http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually ``` The fix is to specify the prebuilt .lib file on the command line: dmd driver.d %cd%\libs\libfoo\libfoo.lib ``` The tutorial is for 32 bit so it u

Re: Simple clarification with "Building Libraries" online documentation

2020-12-16 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 16 December 2020 at 22:51:55 UTC, WhatMeWorry wrote: Looking at; https://dlang.org/dmd-windows.html#library Compile modules separately and then run the librarian on them: dmd -c foo.d dmd -c bar.d phobos.lib -c -p32 foo.lib foo.obj bar.obj abc.obj def.lib My bad. I now see th

Simple clarification with "Building Libraries" online documentation

2020-12-16 Thread WhatMeWorry via Digitalmars-d-learn
Looking at; https://dlang.org/dmd-windows.html#library Compile modules separately and then run the librarian on them: dmd -c foo.d dmd -c bar.d phobos.lib -c -p32 foo.lib foo.obj bar.obj abc.obj def.lib The last line puzzles me. I presume phobos.lib is the "librarian" referred to in the fi

Re: Anybody know if I can build DMD with Visual Studio 2019?

2020-12-02 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 1 December 2020 at 22:58:53 UTC, WhatMeWorry wrote: I'm trying to build DMD with Visual D under Visual Studio as shown in the Wiki: https://wiki.dlang.org/Building_under_Windows The notes say to use the solution vcbuild: You should be able to build DMD using the visual studio s

Anybody know if I can build DMD with Visual Studio 2019?

2020-12-01 Thread WhatMeWorry via Digitalmars-d-learn
I'm trying to build DMD with Visual D under Visual Studio as shown in the Wiki: https://wiki.dlang.org/Building_under_Windows The notes say to use the solution vcbuild: You should be able to build DMD using the visual studio solution found in: dmd\src\vcbuild A typical choice is to build t

DMD -i option, simple question...

2020-11-19 Thread WhatMeWorry via Digitalmars-d-learn
The DMD forum mentions internal design. This is more of a beginner usage question. - from Compiler Switches - -I=directory Look for imports also in directory -i[=pattern ] Enables "include imports" mode, where the compiler will in

.d files without a module statement? Required to be absent?

2020-11-14 Thread WhatMeWorry via Digitalmars-d-learn
I was poking around the dmd code just to "learn from the best" and I came across some files that ended with the .d extension which did not have the module statement. (I was under the naive impression that all .d files must have a module statement) However, in the directory: https://github.

Re: question as to when a new command gets executed

2020-11-11 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 06:21:38 UTC, Jacob Carlborg wrote: On 2020-11-11 06:29, WhatMeWorry wrote: Which begs the question, how would the statement, m_State = new BreakState() ever get executed? class DebuggerSession {     private BreakState m_State = new BreakState();     privat

question as to when a new command gets executed

2020-11-10 Thread WhatMeWorry via Digitalmars-d-learn
I've been studying an 8 year old D project in Github and this code fragment has left me befuddled. I'm confused as to when and how the new BreakState() statement gets executed. Wouldn't the class DebuggerSession need to be instantiated first and then the this() constructor be called? Which

D function in a .d file calling printf refuses to link.

2020-10-18 Thread WhatMeWorry via Digitalmars-d-learn
module mydll; extern (C): import core.stdc.stdio : printf; export { int addSeven(int a, int b) { //printf("Hello from within my DLL"); return a+b+7; } } The above D code file compiles and links, no problems with C:\D\dmd2\samples\d\mydll>dmd -v -m64 mydll.d -L/DLL -L/

Re: why do i need an extern(C): here?

2020-10-16 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 16 October 2020 at 15:14:03 UTC, Ali Çehreli wrote: On 10/15/20 2:42 PM, Ali Çehreli wrote: > I've recently done the same by calling dlopen() and dlsym() > directly. Runtime.loadLibrary documentation says "If the library > contains a D runtime it will be integrated with the current ru

why do i need an extern(C): here?

2020-10-15 Thread WhatMeWorry via Digitalmars-d-learn
I've go a small DLL and a test module both written in D. Why do I need to use the extern(C)? Shouldn't both sides be using D name wrangling? mydll.d module mydll; extern(C): // removing or changing to (D): results in error export {

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 WhatMeWorry via Digitalmars-d-learn
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 work with: [...] [...] [...] total = 12 [...] 1) try

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

2020-10-01 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 1 October 2020 at 20:28:58 UTC, kinke wrote: On Thursday, 1 October 2020 at 20:03:19 UTC, WhatMeWorry wrote: Yes, but shouldn't the /NOENTRY option take care of that. Say, I just want to make a DLL of simple functions. Your little example has 2 problems, the first being an incomp

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

2020-10-01 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 1 October 2020 at 09:22:29 UTC, user1234 wrote: On Wednesday, 30 September 2020 at 11:45:53 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 29 September 2020 at 21:22:21 UTC, WhatMeWorry wrote: module user; export { int myAddSeven(int a, int b); } [...] it is better to use this templa

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

2020-09-29 Thread WhatMeWorry via Digitalmars-d-learn
module user; export { int myAddSeven(int a, int b); } void main() { int total = myAddSeven(2, 3); } dmd -m64 -c user.d module mydll; export extern(D) { int myAddSeven(int a, int b) { return a+b+7; } /* <-- function body */ } dmd -c -shared -m64 mydll.d link mydll.obj /DLL

miscellaneous array questions...

2020-07-20 Thread WhatMeWorry via Digitalmars-d-learn
1) The D Language Reference says: "There are four kinds of arrays..." with the first example being "type* Pointers to data" and "int* p; etc. At the risk of sounding overly nitpicky, isn't a pointer to an integer simply a pointer to an integer? How does that pertain to an array? 2) "

Probably a trivial question regarding version identifier and unittest

2020-05-11 Thread WhatMeWorry via Digitalmars-d-learn
I'm trying to study Adam Ruppe's terminal.d sub-package and I see the following code segment: version(demos) unittest { import arsd.terminal; void main() { // . . . } main; // exclude from docs } Looks like a good baby step to take, so in the command line I use:

What's the difference between sourcePaths and importPaths in DUB?

2019-11-18 Thread WhatMeWorry via Digitalmars-d-learn
The documentation doesn't go into much detail: sourcePaths "" ["" [...]] Allows to customize the path where to look for source files (any folder "source" or "src" is automatically used as a source path if no sourcePaths setting is specified) - note that you usually also need to define "impo

Re: arsd errors on windows

2019-10-17 Thread WhatMeWorry via Digitalmars-d-learn
Really stupid question here, but when I try to run the same command I get: C:\Users\whatmeworry>dub add arsd-official Unknown command: add USAGE: dub [--version] [] [] [-- []] . . . DUB version 1.11.0, built on Oct 6 2018 I thought about dub init, but that still doesn't give me an 'ad

Re: Difference between slice[] and slice

2019-09-25 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 25 September 2019 at 19:25:06 UTC, Ali Çehreli wrote: On 09/25/2019 12:06 PM, WhatMeWorry wrote: > I was > assuming that [] meant "the entirety" of the array. Assuming we're talking about D slices, Yes. (It could be a user-defined type with surprisingly different semantics.) >

Difference between slice[] and slice

2019-09-25 Thread WhatMeWorry via Digitalmars-d-learn
Just got through debugging a line of code which uses dynamic array. It boiled to to my use of []. How should I "D think" about slice[]? The run time error seems to say the the length of [] is zero. I was assuming that [] meant "the entirety" of the array. In short, is there anytime th

Re: It there a way to get this to compile?

2019-09-09 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 9 September 2019 at 19:12:34 UTC, Adam D. Ruppe wrote: On Monday, 9 September 2019 at 19:08:17 UTC, WhatMeWorry wrote: Is this even possible? what are you trying to do? if c is static, it just needs to be initialized by a helper function, like int helper() { int c = 60; f

It there a way to get this to compile?

2019-09-09 Thread WhatMeWorry via Digitalmars-d-learn
Is this even possible? klondike.d(155): Error: no identifier for declarator c klondike.d(155): Error: declaration expected, not = struct FoundationPile { Card[] up;// all cards are face up on the Foundation } FoundationPile[4] foundations; static if(true) { int r = 2; int c =

Quick question regarding dynamic array deletions

2019-09-01 Thread WhatMeWorry via Digitalmars-d-learn
int[] a = [ 3, 7, 9 ]; 1) a = []; and 2) a = null; sets both the .ptr property of the array to null, and the length to 0. whereas 3) a.length = 0; just sets the length to 0. If all the above is correct, does this mean we should just stick to either of the first two forms and never use

How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-29 Thread WhatMeWorry via Digitalmars-d-learn
This is a very stupid question but from Ali's book, I took this segment: writeln("Résumé preparation: 10.25€"); writeln("\x52\ésum\u00e9 preparation: 10.25\€"); and after running it all I get is the following: R├⌐sum├⌐ preparation: 10.25Γé¼ R├⌐sum├⌐ preparation: 10.25Γé¼ I was expecting t

I really don't understand DUB

2019-04-08 Thread WhatMeWorry via Digitalmars-d-learn
I've been using DUB for several years and I've gotten it to work generally. But I've been trying to troubleshoot a DUB issue for two days now and I've come to the conclusion, I don't really understand DUB and I'm tired of muddling through. (Surely it hurts that I've never been exposed to a li

Re: Get this error running the D blog about containerizing D in Docker

2019-03-26 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 26 March 2019 at 21:20:06 UTC, Andre Pany wrote: On Tuesday, 26 March 2019 at 17:36:15 UTC, WhatMeWorry wrote: https://dlang.org/blog/2019/03/14/containerize-your-d-server-application/ I'm following the excellent blog posting by Mr. Nacke, but I keep getting the following error whe

Get this error running the D blog about containerizing D in Docker

2019-03-26 Thread WhatMeWorry via Digitalmars-d-learn
https://dlang.org/blog/2019/03/14/containerize-your-d-server-application/ I'm following the excellent blog posting by Mr. Nacke, but I keep getting the following error when I attempt to compile hellorest with dub. Since everything is pretty much on autopilot, Everything seems to have worked be

Re: C++ GLM(OpenGL Mathematics) D Equivalent.

2018-09-07 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 19:40:10 UTC, JN wrote: On Tuesday, 4 September 2018 at 19:23:16 UTC, SrMordred wrote: Most C++ game related projects uses GLM as they default math/vector lib (even if not using opengl). In D we have (that I found): gfm.math - https://github.com/d-gamedev-team

Re: why use string for this example of appender?

2018-04-16 Thread WhatMeWorry via Digitalmars-d-learn
Thanks all. I sometimes feel like Michael Corleone: "Just when I thought I was out, they pull me back in!" :) I realize it is not the place for it, but sometimes I wish the Library Reference explained things in terms of "why".

Re: does the shared keyword work with mutable structs?

2018-03-09 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 9 March 2018 at 10:42:47 UTC, Kagamin wrote: To make a struct noncopyable, add @disable this(this); to it, then compiler will give an error on an attempt to copy it. I tried the @disable this(this); but now it doesn't even compile? Error: template std.concurrency.spawn cannot deduce

does the shared keyword work with mutable structs?

2018-03-08 Thread WhatMeWorry via Digitalmars-d-learn
I read where shared classes have not been implemented yet. So I'm using just a struct e below: But the output below is showing that sharing is not happening between Struct in main() and the various spawned threads. I'm I doing something wrong? creating queue in EventBuffer constructor even

Shouldn't D be added to this list?

2018-02-06 Thread WhatMeWorry via Digitalmars-d-learn
Sorry if this is the wrong place to post, but I just came across this just now: https://www.khronos.org/opengl/wiki/Language_bindings I was thinking that with derelictGL, D should be on this list? If so, I'm not sure how one would go about this?

Re: How to move an associative array between modules?

2018-01-12 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 11 January 2018 at 23:29:30 UTC, Adam D. Ruppe wrote: On Thursday, 11 January 2018 at 23:20:44 UTC, WhatMeWorry wrote: When I simply move the array out of main() but still in app.d, the compiler returns Error: expression ["SCRATCH":Track("scratch.wav", cast(Sound)1, 0, null),... i

How to move an associative array between modules?

2018-01-11 Thread WhatMeWorry via Digitalmars-d-learn
I've built a sound.d module with lots data types, free functions (initAndOpenSound() loadSound()), and enums etc. In my main/app.d module, I've created the the following associative array: void main(string[] argv) { initAndOpenSound(); Track[string] tracks = [ "SCRATCH"

Is there a way to get this associative array initialization to work?

2018-01-09 Thread WhatMeWorry via Digitalmars-d-learn
enum SoundType { MUSIC = 0, SOUND_EFFECT }; struct Sound { string file; SoundType musicOrSfx; void* ptr; // Mix_Chunk* for sfx; Mix_Music* for music; } immutable Sound[string] soundLibrary = // line 148 [ "SCRATCH" : { file : "scratch.wav", musicOrSfx :

How to I get the dub package version that I want...

2017-12-22 Thread WhatMeWorry via Digitalmars-d-learn
I can compile the derelict-fmod example with dub.json ... "dependencies": { "derelict-util": ">=1.9.1" ... and dub.selections.json ... "versions": { "derelict-util": "2.1.0" ... dub run Fetching derelict-util 2.

Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2017-12-18 Thread WhatMeWorry via Digitalmars-d-learn
I've been using Dub for a while but from the very beginning I decided to go with SDL 100% of the time, So I've got a dub.sdl file like: name "01_10_camera_view_space" description "A minimal D application." authors "kheaser" copyright "Copyright © 2017, kheaser" license "proprietary" dependen

Any derelict fmod users on Linux out there?

2017-12-07 Thread WhatMeWorry via Digitalmars-d-learn
I've tried debugging this for hours to no avail. It works on Windows and Mac fine. But I'm running Antergos Linux (very much like Arch) and it keeps failing at the System Init line. The code is pretty much a copy of the example of derelict fmod on github. I have no idea what the "bindings" num

Infuriating DUB/DMD build bug.

2017-10-05 Thread WhatMeWorry via Digitalmars-d-learn
I've got a github project and using DUB with DMD and I keep running into this problem. I've tried deleting the entire ...\AppData\Roaming\dub\packages folder, but the problem repeats the very next build attempt. Fetching derelict-util 2.0.6 (getting selected version)... Fetching derelict-ft 1

Re: splitter string/char different behavior

2017-09-30 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 30 September 2017 at 18:21:11 UTC, Jon Degenhardt wrote: On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote: [...] It's easy to overlook, but documentation for splitter starts out: Lazily splits a range using an element as a separator. An element of a string

This used to compile for months and months, and now it aborts with Error writing file derelict-assimp3-1.3.0

2017-09-26 Thread WhatMeWorry via Digitalmars-d-learn
I don't know the first step about how to trouble shoot this? I haven't changed anything with my configuration. Using dub registry url 'http://code.dlang.org/' Refreshing local packages (refresh existing: true)... Looking for local package map at C:\ProgramData\dub\packages\local-packages.js

Re: Real beginner traits question

2017-09-25 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 25 September 2017 at 06:07:58 UTC, H. S. Teoh wrote: On Mon, Sep 25, 2017 at 05:28:13AM +, WhatMeForget via Digitalmars-d-learn wrote: [...] You're not the only one. I stared at this same piece of documentation for a long time before I figured out what it meant. This is anoth

Mixed up over mixins.

2017-08-20 Thread WhatMeWorry via Digitalmars-d-learn
It's stuff like this which makes me very frustrated. Or depressed because it demonstrates just how poor a programmer I am: string printStatement(string message) { return `writeln("` ~ message ~ `");`; } void main() { // Mixins are for mixing in generated code into the source code.

Re: real simple delegate question.

2017-08-19 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 18 August 2017 at 20:39:38 UTC, angel wrote: On Friday, 18 August 2017 at 02:38:15 UTC, WhatMeForget wrote: [...] This actually appears correct ... The 1-st example: Each call to makeCalculator() increments a static (i.e. shared among all makeCalculator() instances) variable - cont

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

2017-07-26 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:32:07 UTC, Adam D. Ruppe wrote: I've hand rolled a function which is working for me currently, but with my coding ability, I'd feel much safer with something official :) You could also do (cast(ubyte[]) array).length. This was my (way over complicated) att

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

2017-07-26 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:31:33 UTC, Mike Parker wrote: On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: [...] Because .sizeof has nothing to do with how many elements are in the array. It tells you how much space the array itself takes up. Totally agree. .length ret

unresolved external symbol error (How to resolve?)

2017-07-22 Thread WhatMeWorry via Digitalmars-d-learn
Linking... 01_06_coord_systems.obj : error LNK2001: unresolved external symbol _D11common_game12__ModuleInfoZ 01_06_coord_systems.obj : error LNK2001: unresolved external symbol _D14post_processor12__ModuleInfoZ I've gotten plenty of undefined external symbol errors in my time but how does o

Re: First time user of LDC and getting newbie problems.

2017-06-13 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 13 June 2017 at 12:39:53 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 13 June 2017 at 12:38:03 UTC, Joseph Rushton Wakeling wrote: On Sunday, 11 June 2017 at 21:58:27 UTC, WhatMeForget wrote: Just trying to compile a "Hello World" using dub and ldc2. I presume from your command

Dub or Dmd trying to use some funny path to find linker.exe

2017-06-10 Thread WhatMeWorry via Digitalmars-d-learn
Dub or Dmd dies when it can't find the linker. Like so: C:\Users\kheaser\Git\Delivery\projects\00_01_print_ogl_ver>dub run --arch=x86_64 --force Performing "debug" build using dmd for x86_64. derelict-util 2.0.6: building configuration "library"... derelict-al 1.0.3: building configuration "l

when I run dub within git bash, dub prompts are not displayed. For instance...

2017-06-10 Thread WhatMeWorry via Digitalmars-d-learn
kheaser@IT-ASST-SB MINGW64 /c/Users/kheaser/Git/Delivery/projects (master) $ dub init 00_01_print_ogl_ver ... All this white space here is me just pressing the Enter key ... to get the default values. Package recipe format (sdl/json) [json]: Name [00_01_print_ogl_ver]: Description [A minim

Re: Structure of platform specific vs non platform specific code

2017-05-09 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 8 May 2017 at 21:16:53 UTC, Igor wrote: Hi, I am following Casey Muratori's Handmade Hero and writing it in DLang. This sounds very interesting. Maybe make it a public github project?

Re: Cleaning up Dub/Dmd builds

2017-04-18 Thread WhatMeWorry via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 15:15:47 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 15:07:27 UTC, WhatMeWorry wrote: When I try to upload these files to my new repo, GitHub (rightfully so) complains that I have too many files. Since I'm using sdl and not json, can I safely delete a

Cleaning up Dub/Dmd builds

2017-04-18 Thread WhatMeWorry via Digitalmars-d-learn
Just some basic questions regarding Dub projects with GitHub. I'm just getting my toes wet with GitHub so these might be pretty naive questions. I've got about 35 mini dub projects where each project holds an OpenGL tutorial. like so: 01_01_hello_window .dub build app

simple static if / traits question...

2017-02-22 Thread WhatMeWorry via Digitalmars-d-learn
I'm doing conditional compilation using static ifs like so: enum bool audio = true; // if audio flag is present and set to true, add to code build static if ( (__traits(compiles, audio)) && audio) playSound(soundSys, BLEEP ); This works, b

Re: DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 11 February 2017 at 03:10:35 UTC, WhatMeWorry wrote: I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load ..\common\derelict_libraries.d

DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load ..\common\derelict_libraries.d(122,5): Error: undefined identifier 'DerelictFmodStudio' In the

Re: Is there anything fundamentally wrong with this code?

2017-02-03 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 3 February 2017 at 18:37:15 UTC, Johan Engelen wrote: On Friday, 3 February 2017 at 17:20:43 UTC, WhatMeWorry wrote: [...] The error is in this line. Instead of assigning to the `postProc` at module scope, you are defining a new local variable and assigning to it. [...]

Is there anything fundamentally wrong with this code?

2017-02-03 Thread WhatMeWorry via Digitalmars-d-learn
The code below compiles fine but I always get a run time abort with the error down below. Isn't the postProc at module scope so shouldn't the class instance always be around (ie not deallocated?) If it helps, this was translated from C++ code. Thanks. -file post_proces

A matter of propiety

2017-01-27 Thread WhatMeWorry via Digitalmars-d-learn
module_common import app; // Ugly? Bad? Better way? common_func() { static if (compileTimeFlag1) codeBlockA static if (compileTimeFlag2) codeBlockB static if (compileTimeFlag3) codeBlockC } I want to have many stan

  1   2   3   >