Re: What is difference between struct and class?

2019-06-03 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 3 June 2019 at 09:43:25 UTC, Rnd wrote: These similarities and differences should be highlighted in documentation etc since many new users have at least some knowledge of C/C++ and understanding will be easier. Perhaps this will help: https://dlang.org/articles/ctod.html

Re: Reading Dicom files in Dlang

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 15:56:00 UTC, Rémy Mouëza wrote: On Monday, 3 June 2019 at 14:19:40 UTC, Rnd wrote: [...] We can call C functions directly from D. First, the functions must be declared in D, as D's syntax is different from C's. [...] Thanks for a very comprehensive answer.

Re: Error: char 0x200b not allowed in identifier

2019-06-03 Thread zoujiaqing via Digitalmars-d-learn
On Monday, 3 June 2019 at 14:41:18 UTC, ag0aep6g wrote: On 03.06.19 15:37, zoujiaqing wrote: Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier U+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character into your code. You have to get

Re: Reading Dicom files in Dlang

2019-06-03 Thread Rémy Mouëza via Digitalmars-d-learn
On Monday, 3 June 2019 at 14:19:40 UTC, Rnd wrote: On Friday, 31 May 2019 at 16:43:28 UTC, rnd wrote: On Friday, 31 May 2019 at 13:49:02 UTC, KnightMare wrote: struct Range { private __vector(ushort) _outer; private size_t _a, _b; this(vector(ushort) data, size_t a, size_t b) {

Re: Error: char 0x200b not allowed in identifier

2019-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 03.06.19 15:37, zoujiaqing wrote: Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier U+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character into your code. You have to get rid of it. To do it manually, navigate to the locations

Re: Reading Dicom files in Dlang

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Friday, 31 May 2019 at 16:43:28 UTC, rnd wrote: On Friday, 31 May 2019 at 13:49:02 UTC, KnightMare wrote: struct Range { private __vector(ushort) _outer; private size_t _a, _b; this(vector(ushort) data, size_t a, size_t b) { // line 457 _outer = data;

Error: char 0x200b not allowed in identifier

2019-06-03 Thread zoujiaqing via Digitalmars-d-learn
Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(12,23): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(17,15): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(17,26): Error:

Re: How can I get a backtrace when my WndProc throws?

2019-06-03 Thread Markus via Digitalmars-d-learn
On Monday, 3 June 2019 at 12:09:18 UTC, Adam D. Ruppe wrote: Don't use just e.msg, that's just the string the constructor sent, use e.toString and see if it works for you. toString works, thanks! :)

Re: How can I get a backtrace when my WndProc throws?

2019-06-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 3 June 2019 at 11:19:22 UTC, Markus wrote: a throw, has anyone an idea how to do this? First thing I'd try is to just print the exception when you catch it. The toString method can do a backtrace. Don't use just e.msg, that's just the string the constructor sent, use e.toString

How can I get a backtrace when my WndProc throws?

2019-06-03 Thread Markus via Digitalmars-d-learn
Hi, I'm using core.sys.windows.windows to make a Windows GUI, and the WindowProc must be nothrow. My code does not provide me a stack backtrace when some exception is thrown in there. I would like to have at least the number of the line that caused a throw, has anyone an idea how to do this?

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

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

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

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

Re: What is difference between struct and class?

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:54:12 UTC, Jonathan M Davis wrote: structs in D are basically the same as C++ classes that don't have inheritance and can be put on the stack or the heap, and classes in D are akin to C++ classes that use inheritance and are always put on the heap and used via

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: 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

Re: What is difference between struct and class?

2019-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 3, 2019 1:13:44 AM MDT Rnd via Digitalmars-d-learn wrote: > On Monday, 3 June 2019 at 06:01:15 UTC, Jonathan M Davis wrote: > > On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via > > > > Digitalmars-d-learn wrote: > >> On Monday, > > > > http://ddili.org/ders/d.en/index.html > > > > If

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

Re: Reading .pem files for secured

2019-06-03 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote: if I understand the logic of Base64, it's that each character stores 6 bits. My private key .pem has 49 lines of 64 characters worth of Base64, though the sat line isn't full. Anyway, this is data worth of over 18000 bits. The RSA key is

Re: What is difference between struct and class?

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 06:01:15 UTC, Jonathan M Davis wrote: On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via Digitalmars-d-learn wrote: On Monday, http://ddili.org/ders/d.en/index.html If you want to know more about structs and classes specifically, then you can go straight to the sections

Re: What is difference between struct and class?

2019-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via Digitalmars-d-learn wrote: > On Monday, 3 June 2019 at 00:47:27 UTC, Adam D. Ruppe wrote: > > On Monday, 3 June 2019 at 00:17:08 UTC, Rnd wrote: > >> What additional features do classes offer in D? > > > > Classes support built-in runtime polymorphism