Re: Downloading files over TLS

2020-06-26 Thread User via Digitalmars-d-learn
On Friday, 26 June 2020 at 10:12:09 UTC, Jacob Carlborg wrote: Windows: I don't know that much of this platform. * std.net.curl and basically all other options already mentioned relies on OpenSSL, which is not provided by the platform * SChannel. As far as I know, this the the platform

Convert program to 2020: replace foreach loop with map, filter and friends

2020-03-30 Thread User via Digitalmars-d-learn
I'd like to convert the following program to 2020 standards (i.e, replace the foreach block with a one-line code). I've tried much and I failed. This is the code that works (1990s style) -- import std; void main() { immutable URL =

Re: exporting function from betterc to windows dll

2020-03-14 Thread User via Digitalmars-d-learn
On Saturday, 14 March 2020 at 20:53:45 UTC, Abby wrote: I would like to export some functions from my bettec dll for dotnet core application in windows. [...] It is the calling convention.

Re: I had a bad time with slice-in-struct array operation forwarding/mimicing. What's the best way to do it?

2019-05-09 Thread Random D user via Digitalmars-d-learn
On Saturday, 4 May 2019 at 15:36:51 UTC, Nicholas Wilson wrote: On Saturday, 4 May 2019 at 15:18:58 UTC, Random D user wrote: I wanted to make a 2D array like structure and support D slice like operations, but I had surprisingly bad experience. The de facto multi dimensional array type in D

Re: I had a bad time with slice-in-struct array operation forwarding/mimicing. What's the best way to do it?

2019-05-09 Thread Random D user via Digitalmars-d-learn
On Saturday, 4 May 2019 at 16:10:36 UTC, Adam D. Ruppe wrote: On Saturday, 4 May 2019 at 15:18:58 UTC, Random D user wrote: But array copy and setting/clearing doesn't: int[] bar = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]; foo[] = bar[]; Generally speaking, opIndex

I had a bad time with slice-in-struct array operation forwarding/mimicing. What's the best way to do it?

2019-05-04 Thread Random D user via Digitalmars-d-learn
I wanted to make a 2D array like structure and support D slice like operations, but I had surprisingly bad experience. I quickly copy pasted the example from the docs: https://dlang.org/spec/operatoroverloading.html#array-ops It's something like this: struct Array2D(E) { E[] impl;

Re: SysTime comparesin - dropMiliseconds

2018-08-12 Thread User via Digitalmars-d-learn
On Sunday, 12 August 2018 at 19:50:44 UTC, User wrote: I have to synchronize a directory. If remote file is newer I copy to local. If local file is newer I copy it to remote server. For some reason remote timestamp does not contain milliseconds, so comparison (localFileTime < remoteFileT

SysTime comparesin - dropMiliseconds

2018-08-12 Thread User via Digitalmars-d-learn
I have to synchronize a directory. If remote file is newer I copy to local. If local file is newer I copy it to remote server. For some reason remote timestamp does not contain milliseconds, so comparison (localFileTime < remoteFileTime, etc) fails. I need help to drop milliseconds from local

Re: Deleting a file with extsion *.FIFO in Windows

2018-06-01 Thread Dlang User via Digitalmars-d-learn
On 6/1/2018 12:06 AM, vino.B wrote: On Thursday, 24 May 2018 at 11:31:15 UTC, bauss wrote: On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote: Hi All,   Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B What exactly is your

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 3:18 PM, Ali Çehreli wrote: On 05/10/2018 01:03 PM, Dlang User wrote: >> this didn´t work either. >> note that 'f.data+= 2;' don't call the write property > > That's odd, it works on my machine (Windows 10 with V2.079.0 DMD compiler). Try putting w

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 2:50 PM, SrMordred wrote: On Thursday, 10 May 2018 at 19:41:41 UTC, Dlang User wrote: On 5/10/2018 1:43 PM, SrMordred wrote: [...] I am relatively new to D and I was under the impression that that was a limitation of @property functions. But, re-reading the language reference

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 1:43 PM, SrMordred wrote: struct T {     int x;     @property ref X(){ return x; }     @property X(int v)     {     x = v;     } } T t; t.X += 10; The setter 'x = v' are not executed because i´m returning the reference of x. And without the 'ref' the compiler complains

Re: signbit question

2018-03-15 Thread Dlang User via Digitalmars-d-learn
On 3/15/2018 12:39 PM, Miguel L wrote: On Thursday, 15 March 2018 at 17:31:38 UTC, rumbu wrote: On Thursday, 15 March 2018 at 17:18:08 UTC, Miguel L wrote: On Thursday, 15 March 2018 at 16:31:56 UTC, Stefan Koch wrote: On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote: [...]

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread Random D user via Digitalmars-d-learn
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: In C#, structs can inherit from and implement interfaces. Is that simply because it hasn't been implemented or suggested yet for D, or was there a deliberate design decision? Thanks for your insight, Mike I think it's

Re: .LIB pagesize exceeds 512

2017-12-10 Thread user via Digitalmars-d-learn
On Sunday, 10 December 2017 at 21:51:37 UTC, Mike Wey wrote: On 10-12-17 16:57, user wrote: Could someone please list some workarounds? I am trying to compile a demo app from gtkd. I tried compiling gtkd using dub with --build=plain option and still got that error when compiling the demo app

.LIB pagesize exceeds 512

2017-12-10 Thread user via Digitalmars-d-learn
Could someone please list some workarounds? I am trying to compile a demo app from gtkd. I tried compiling gtkd using dub with --build=plain option and still got that error when compiling the demo app. Using the latest dmd. Thanks in advance.

Unable to compile GtkD on windows

2017-11-15 Thread user via Digitalmars-d-learn
I tried compiling GtkD, I get the error message: rdmd Build.d Error: more than 32767 symbols in object file 1. How to work around this? 2. Is D still unfriendly to newbies? I am disappoint :-( Using: DMD 2.077 GtkD 3.7.1 gtk3-runtime_3.22.24-1, 32bit

Re: I think is a bug?

2017-03-11 Thread Random D user via Digitalmars-d-learn
On Sunday, 12 March 2017 at 01:55:20 UTC, ketmar wrote: Random D user wrote: How come string* suddenly has a .length property? due to automatic pointer dereferencing that `.` does. no, not a bug. Ah... right. Silly me. Of course, since string is actually immutable(char)[]. That's bit

I think is a bug?

2017-03-11 Thread Random D user via Digitalmars-d-learn
int*[] foo; foo.length = 5; import std.c.string; int* baz = cast(string*)malloc(50); import std.c.stdio; printf("%d %d", foo.length, baz.length ); prints: Error: no property 'length' for type 'int*' BUT: string*[] foo; foo.length = 5; import std.c.string; string* baz =

Why can't I init a new var from const var?

2017-02-11 Thread Random D user via Digitalmars-d-learn
I can init a variable from mutable source without defining any constructor or assignment operators, but not if the source is const. I would imagine the behavior to be the same with mutable and const source, since it's just reading the source and copying it. Is there a reason for this? Or is

Re: fPIC Error

2016-11-03 Thread dlang user via Digitalmars-d-learn
On Thursday, 3 November 2016 at 06:11:48 UTC, rikki cattermole wrote: Took me a while to replicate your build environment but it looks like a false alarm. rikki@debian:/tmp/test$ dmd test.d rikki@debian:/tmp/test$ file test test: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),

fPIC Error

2016-11-02 Thread Dlang User via Digitalmars-d-learn
I am running Debian Testing and I think I have run into the recent fPIC issue. This is the source code for the test project I am using: import std.stdio; void main() { writeln("Edit source/app.d to start your project."); readln(); } When I try to compile a project, I get

Re: How to detect/filter modules in __traits(allMembers)?

2016-06-12 Thread Random D user via Digitalmars-d-learn
On Saturday, 11 June 2016 at 20:30:47 UTC, Basile B. wrote: On Saturday, 11 June 2016 at 19:45:56 UTC, Random D user wrote: Any good ideas how to do that? I couldn't figure it out in a short amount of time, but I expect that it's possible. I'm probably missing something obvious here

How to detect/filter modules in __traits(allMembers)?

2016-06-11 Thread Random D user via Digitalmars-d-learn
Any good ideas how to do that? I couldn't figure it out in a short amount of time, but I expect that it's possible. I'm probably missing something obvious here. Probably because D's reflection/meta programming facilities are a bit all over the place (and unnecessarily convoluted IMO). Also

Re: AA struct hashing bug?

2015-12-08 Thread Random D user via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 11:04:49 UTC, Random D user wrote: I need to look into this more. Ok. This is minimal app that crashes for me. If someone could try this: class App { this() { } void crash( int val ) in { assert( val == 1 ); } body

Re: AA struct hashing bug?

2015-12-08 Thread Random D user via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 01:23:40 UTC, Ivan Kazmenko wrote: On Monday, 7 December 2015 at 22:03:42 UTC, Alex Parrill wrote: On Monday, 7 December 2015 at 18:48:18 UTC, Random D user Tested the same code with -m32 and -m64 on Windows. Works for me, too. I tried this again. And it seems

Re: How to make a transparent wrapper type?

2015-12-08 Thread Random D user via Digitalmars-d-learn
On Monday, 7 December 2015 at 20:03:07 UTC, Namespace wrote: This seems to work: struct RefVal(T) { private T* ptr; this(T* val) { ptr = val; } ref auto opAssign(U)(auto ref U value) { *ptr = value;

Re: How to make a transparent wrapper type?

2015-12-08 Thread Random D user via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 10:26:18 UTC, Random D user wrote: On Monday, 7 December 2015 at 20:03:07 UTC, Namespace wrote: This seems to work: struct RefVal(T) { private T* ptr; this(T* val) { ptr = val; } ref auto opAssign(U

AA struct hashing bug?

2015-12-07 Thread Random D user via Digitalmars-d-learn
struct Foo { this( int k ) { a = k; } int a; } Foo foo; int[ Foo ] map; map[ foo ] = 1; // Crash! bug? // This also crashes. I believe crash above makes a call like this (or similar) in the rt. //auto h = typeid( foo ).getHash( ); // Crash! win64 & dmd 2.69.2

How to make a transparent wrapper type?

2015-12-07 Thread Random D user via Digitalmars-d-learn
I kind of miss reference values on stack, so I attempted to make one in a struct. Pointers are pretty good (since d doesn't have ->), but it would be nice to avoid dereferencing them explicitly on assignment. Since reference is a pointer that you can't change afterwards. I tried something like

AA deterministic order ?

2015-11-25 Thread user-6431 via Digitalmars-d-learn
I know that AA items order does not follow the additions but is the order deterministic ? For example for a given set of items, will they always be ordered in the same way ? (I mean whatever is the way I append them to the AA).

Re: Builtin array and AA efficiency questions

2015-10-15 Thread Random D user via Digitalmars-d-learn
Ah missed your post before replying to H.S. Teoh (I should refresh more often). Thanks for reply. On Thursday, 15 October 2015 at 19:50:27 UTC, Steven Schveighoffer wrote: Without more context, I would say no. assumeSafeAppend is an assumption, and therefore unsafe. If you don't know what

Re: Builtin array and AA efficiency questions

2015-10-15 Thread Random D user via Digitalmars-d-learn
Thanks for thorough answer. On Thursday, 15 October 2015 at 18:46:22 UTC, H. S. Teoh wrote: It adjusts the size of the allocated block in the GC so that subsequent appends will not reallocate. So how does capacity affect this? I mean what is exactly a GC block here. Shrink to fit bit

Builtin array and AA efficiency questions

2015-10-15 Thread Random D user via Digitalmars-d-learn
So I was doing some optimizations and I came up with couple basic questions... A) What does assumeSafeAppend actually do? A.1) Should I call it always if before setting length if I want to have assumeSafeAppend semantics? (e.g. I don't know if it's called just before the function I'm in) A.2)

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread Random D user via Digitalmars-d-learn
On Saturday, 19 September 2015 at 07:25:58 UTC, ponce wrote: On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote: So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread Random D user via Digitalmars-d-learn
On Saturday, 19 September 2015 at 21:48:25 UTC, Random D user wrote: Assertion failure: 'type->ty != Tstruct || ((TypeStruct *)type)->sym == this' on line 957 in file 'struct.c' Ok managed to reduce this one to my own copy paste bug. This is invalid code, but compiler shouldn't crash...

Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-18 Thread Random D user via Digitalmars-d-learn
So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go away if I disable the optimizer. I get: tym = x1d Internal error: backend\cgxmm.c 547 Does anyone have a clue what might trigger

Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
I'm trying to make a base class with get property and a sub class with corresponding set property. The value for the base class is set via constructor. The intuitive way doesn't seem to work and workarounds are unnecessarily ugly (considering you'll sprinkle them all over the codebase).

Re: Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 03:17:05 UTC, Meta wrote: Considering Father defines the function `int eat()` and Daughter defines the completely different function `int eat(int)`, it doesn't surprise me. You're not using virtual dispatch when you do `return super.eat` or `d.Father.eat()`,

Re: Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 03:54:34 UTC, Adam D. Ruppe wrote: On Wednesday, 16 September 2015 at 03:48:59 UTC, Random D user Given that, normally properties are just overloaded methods in D, it's pretty sad classes break this behavior/convention. The D behavior for overloading

Re: I guess this is a bug?

2015-09-12 Thread Random D user via Digitalmars-d-learn
On Saturday, 12 September 2015 at 18:28:02 UTC, Random D user wrote: or is it some obscure feature conflict? [...] Oh... and I'm using win 64-bit and dmd 2.068.1, but this behavior was present earlier than that...

I guess this is a bug?

2015-09-12 Thread Random D user via Digitalmars-d-learn
or is it some obscure feature conflict? struct Foo { this( float x_, float y_ ) { // option A //x = x_; //y = y_; // option B v[0] = x_; v[1] = y_; } union { struct { float x = 0; float

function name inside a funciton

2014-04-11 Thread user
Can someone please tell me how to get a function or method name inside that function/method's body? For example ... void foo(int x) { string name = getFunctionName(); assert(name == foo); } Compile time or runtime either is OK. Thanks

Re: function name inside a funciton

2014-04-11 Thread user
Never mind, just discovered __PRETTY_FUNCTION__. On Saturday, 12 April 2014 at 02:39:23 UTC, user wrote: Can someone please tell me how to get a function or method name inside that function/method's body? For example ... void foo(int x) { string name = getFunctionName(); assert(name

DWT Gui program without console

2013-04-27 Thread user
Hi, writing a GUI tool using DWT, looks like the windows console pops up everytime I run the tool. How can I prevent/supress the console? I did some googling and found a tip that -version=gui helps, but its not working for me. Thanks in advance. user

Ubuntu installation not working

2011-07-29 Thread Confused user
On an Ubuntu 11.04 system, I've been using the D1 version. Yesterday, I tried to remove it, and install the D2 version. When trying to compile hello world, I always get object.d: Error: module object is in file 'object.d' which cannot be read Specify path to file 'object.d' with -I switch when

Re: setting array dimensions at runtime

2010-12-05 Thread user
On 5-12-2010 19:20, Matthias Walter wrote: The only thing I've been able to think of is byte[][] a; a.length = size; for (int i; i size; i++) { a[i].length = size; } Well, you can do at least: auto a = new byte[][size]; foreach (ref row; a) row = new byte[size];

setting array dimensions at runtime

2010-12-05 Thread user
Hello, I've been wondering what the easiest way is to set the dimension of an array during runtime. You can't write byte[][] a = new byte[size][size]; because the compiler will give an error. The only thing I've been able to think of is byte[][] a; a.length = size; for (int i; i