Extern/scope issue

2021-04-03 Thread DLearner via Digitalmars-d-learn
'Testmain' imports module 'testmod'. Both are shown below. I expected 1,1,2,2. I got 1,0,2,1 - which speaks to scope/extern misunderstanding Any ideas? Best regards Testmain: int xvar; import testmod; void main() { import std.stdio; writeln("Entering: main"); xvar = 1;

Re: Static array initialisation

2021-04-01 Thread DLearner via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 23:21:59 UTC, russhy wrote: On Wednesday, 31 March 2021 at 17:54:38 UTC, DLearner wrote: On Wednesday, 31 March 2021 at 17:46:25 UTC, Imperatorn wrote: On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did: immutable uint MemSize=100; //

Re: Static array initialisation

2021-03-31 Thread DLearner via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 18:00:32 UTC, Steven Schveighoffer wrote: On 3/31/21 1:54 PM, DLearner wrote: On Wednesday, 31 March 2021 at 17:46:25 UTC, Imperatorn wrote: On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did:    immutable uint  MemSize=100;  // Memory size

Re: Static array initialisation

2021-03-31 Thread DLearner via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 17:46:25 UTC, Imperatorn wrote: On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did: immutable uint MemSize=100; // Memory size in bytes. // Memory Pool ubyte[MemSize] MemPool = 8; And had a look in memory. I think the compiler set up

Static array initialisation

2021-03-31 Thread DLearner via Digitalmars-d-learn
Hi I did: immutable uint MemSize=100; // Memory size in bytes. // Memory Pool ubyte[MemSize] MemPool = 8; And had a look in memory. I think the compiler set up 101 '8's, not 100 in memory. Which I did not expect. Best regards

Re: Loading assimp

2017-03-27 Thread Dlearner via Digitalmars-d-learn
On Sunday, 26 March 2017 at 21:52:42 UTC, ag0aep6g wrote: On 03/26/2017 11:31 PM, Dlearner wrote: SDL_Surface* surface = IMG_Load(filename.ptr); if (surface is null) { writeln("surface is null: ", to!string(IMG_GetError())); } else { writeln(filename); } From

Re: Loading assimp

2017-03-26 Thread Dlearner via Digitalmars-d-learn
On Sunday, 26 March 2017 at 12:40:42 UTC, Dlearner wrote: ... About half the textures seem to load fine. Some progress! I don't know why, but when I get to the 8th texture, the filename has some garbage attached. SDL_Surface* surface = IMG_Load(filename.ptr); if (surface is null) {

Re: Loading assimp

2017-03-26 Thread Dlearner via Digitalmars-d-learn
On Sunday, 26 March 2017 at 11:10:55 UTC, ag0aep6g wrote: On Sunday, 26 March 2017 at 10:34:21 UTC, Dlearner wrote: I came back to this project and realised my mistakes (Importer is a class for the C++ API, and we're using the C API). So I fixed all my errors, but now I get an access

Re: Loading assimp

2017-03-26 Thread Dlearner via Digitalmars-d-learn
I came back to this project and realised my mistakes (Importer is a class for the C++ API, and we're using the C API). So I fixed all my errors, but now I get an access violation. As far as I can tell, it seems to be an issue with `aiGetMaterialTexture`. It is meant to return an aiString with

Re: Loading assimp

2017-01-29 Thread Dlearner via Digitalmars-d-learn
Need to rez this thread because I ran into a wall. Two little things: 1) Can't seem to get the Importer class to work ("undefined identifier 'Importer' ", etc), and 2) GetTexture and GetTextureCount for aiMaterial don't seem to work (source\model.d(105,28): Error: no property

Re: Learning resources

2017-01-25 Thread Dlearner via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 22:53:14 UTC, bachmeier wrote: On Tuesday, 24 January 2017 at 20:15:38 UTC, Dlearner wrote: [...] This sounds like exactly what you want: https://www.packtpub.com/application-development/d-cookbook It's not on sale right now, but if you've got the money, it's

Re: Learning resources

2017-01-24 Thread Dlearner via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 21:14:08 UTC, pineapple wrote: On Tuesday, 24 January 2017 at 20:15:38 UTC, Dlearner wrote: Hey all! I'm learning programming through D and having a really good time (much better than with C++ or Python). I'm aiming to make little games with it as a hobby so

Learning resources

2017-01-24 Thread Dlearner via Digitalmars-d-learn
Hey all! I'm learning programming through D and having a really good time (much better than with C++ or Python). I'm aiming to make little games with it as a hobby so I've learned some OpenGL stuff. But, I feel like I'm learning more library code rather than D concepts and idioms, especially

Re: Making .exe

2017-01-19 Thread Dlearner via Digitalmars-d-learn
On Thursday, 19 January 2017 at 20:56:41 UTC, Nemanja Boric wrote: On Thursday, 19 January 2017 at 18:58:31 UTC, Dlearner wrote: [...] Hello! The binary should be in the working directory: ``` ➜ dub init Package recipe format (sdl/json) [json]: Name [test-dub]: Description [A minimal D

Making .exe

2017-01-19 Thread Dlearner via Digitalmars-d-learn
Hey! I wrote a little program that has an image bounce around and change colours, like the old DVD player screensavers. How can I build this as a little .exe file that I can send to someone? In the dub documentation there is something like `dub --build=`, but I'm not entirely sure what this

Re: Changing template parameters

2017-01-16 Thread Dlearner via Digitalmars-d-learn
On Monday, 16 January 2017 at 16:08:07 UTC, Rene Zwanenburg wrote: On Monday, 16 January 2017 at 15:56:16 UTC, Jack Stouffer wrote: Same way you use any template parameters, auto i = uniform!("(]")(0, 1000); Also, if the template parameter consists of a single token you can omit the

Changing template parameters

2017-01-16 Thread Dlearner via Digitalmars-d-learn
Hey, quick question! I'm messing around with std.random and noticed that you can change the boundaries parameter to be either open or closed intervals on either side. By default it is "[)". How do I change these template parameters?

Re: Loading assimp

2017-01-10 Thread Dlearner via Digitalmars-d-learn
On Tuesday, 10 January 2017 at 00:10:12 UTC, Mike Parker wrote: On Monday, 9 January 2017 at 18:13:03 UTC, Dlearner wrote: I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try

Loading assimp

2017-01-09 Thread Dlearner via Digitalmars-d-learn
I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error:

Re: DLang/Wiki/'Hello World'/Run Code/Disassembly

2016-10-21 Thread DLearner via Digitalmars-d-learn
On Friday, 21 October 2016 at 09:07:35 UTC, cym13 wrote: On Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote: [...] What makes you think that? It's hard to tell if you don't give any information. I pressed the 'Run' button and got the 'Hello World'. I pressed the 'Disassembly'

DLang/Wiki/'Hello World'/Run Code/Disassembly

2016-10-21 Thread DLearner via Digitalmars-d-learn
Code ran with expected output, but Disassembly seemed to go in a loop?

Callbacks in D

2016-10-06 Thread DLearner via Digitalmars-d-learn
Please, could someone post here, or provide a link to, some simple, debugged examples. Best regards

Assert question

2016-07-26 Thread DLearner via Digitalmars-d-learn
Suppose a program contains several points that control should not get to. So each such point is blocked by assert(0). What is the recommended way of identifying which assert has been triggered? Is one allowed anything like 'assert(0,"Crashed at point A");', where the message goes to stderr?

Where does one post a proposal for a language change?

2016-07-12 Thread DLearner via Digitalmars-d-learn
General/Issues/or...

Re: good reasons not to use D?

2015-11-03 Thread DLearner via Digitalmars-d-learn
On Saturday, 31 October 2015 at 14:37:23 UTC, rumbu wrote: On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: I'm writing a talk for codemesh on the use of D in finance. Any other thoughts? For finance stuff - missing a floating point decimal data type. Things like 1.1 + 2.2 =

Re: Array start index

2015-08-03 Thread DLearner via Digitalmars-d-learn
On Monday, 3 August 2015 at 13:45:01 UTC, bachmeier wrote: On Sunday, 2 August 2015 at 21:58:48 UTC, QAston wrote: Adding 1-indexed arrays to the language fixes nothing. Just write your 1-indexed array type and if you enjoy using it, publish it as a library. Who knows, if demand is high it

Re: Array start index

2015-08-01 Thread DLearner via Digitalmars-d-learn
On Saturday, 1 August 2015 at 17:55:06 UTC, John Colvin wrote: On Saturday, 1 August 2015 at 09:35:53 UTC, DLearner wrote: Does the D language set in stone that the first element of an array _has_ to be index zero? For the builtin slice types? Yes, set in stone. Wouldn't starting array

Array start index

2015-08-01 Thread DLearner via Digitalmars-d-learn
Does the D language set in stone that the first element of an array _has_ to be index zero? Wouldn't starting array elements at one avoid the common 'off-by-one' logic error, it does seem more natural to begin a count at 1. Actually, maybe even better to allow array definitions of form int

Re: Multi-dimensional fixed arrays

2015-07-01 Thread DLearner via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 22:04:24 UTC, Justin Whear wrote: alias IntList = int[10]; IntList[3] myIntLists; int[10][3] myOtherIntLists; // same type as above I understand the rationale, but some issues: 1. The rationale implicitly takes treats an n-dim array as a (n-1)-dim array x

Re: Multi-dimensional fixed arrays

2015-06-30 Thread DLearner via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 20:33:31 UTC, jmh530 wrote: On Tuesday, 30 June 2015 at 20:17:12 UTC, Justin Whear wrote: [...] I think this is a good explanation. Looking through http://dlang.org/arrays.html I see that the multidimensional array indexing is not particularly focused on (could

Multi-dimensional fixed arrays

2015-06-30 Thread DLearner via Digitalmars-d-learn
Suppose: 'int [1][2] foo;' Probably I misunderstand, but TDPL seems to say that foo has two elements: foo[0][0] and foo[1][0] as opposed to two elements: foo[0][0] and foo[0][1] Is this correct?

Suggested enhancements/changes to D

2015-06-24 Thread DLearner via Digitalmars-d-learn
Is there a place where these should be posted for discussion?

Text UI for D?

2015-03-20 Thread DLearner via Digitalmars-d-learn
Does D have a recommended package for this - like (n)curses for C?

Arrays of Unions of Classes?

2015-02-06 Thread DLearner via Digitalmars-d-learn
I'm just wondering how I would go about reserving a section of the heap so I can have linear access to classes of different types. Storage space--not too worried about wasting; each class I want to store only has a few int sized variables each and I'm not going to cry over a little padding.

Forward reference to nested function not allowed?

2014-05-31 Thread DLearner via Digitalmars-d-learn
Hi, import std.stdio; void main() { writefln(Entered); sub1(); sub1(); sub1(); writefln(Returning); void sub1() { static int i2 = 6; i2 = i2 + 1; writefln(%s,i2); }; } does not compile, but import std.stdio; void main() { void sub1() {

Re: TDPL - Andrei Alexandrescu

2014-05-26 Thread DLearner via Digitalmars-d-learn
On Sunday, 25 May 2014 at 15:27:05 UTC, Gary Willoughby wrote: On Sunday, 25 May 2014 at 15:07:56 UTC, DLearner wrote: Does the current D specification differ from that used in the book (and, if it does, is there a link to the changes)? http://erdani.com/tdpl/errata/ Thanks!

TDPL - Andrei Alexandrescu

2014-05-25 Thread DLearner via Digitalmars-d-learn
Does the current D specification differ from that used in the book (and, if it does, is there a link to the changes)?

<    1   2