Re: this is not an lvalue

2016-12-13 Thread kink via Digitalmars-d-learn

On Tuesday, 13 December 2016 at 16:23:16 UTC, Adam D. Ruppe wrote:

On Tuesday, 13 December 2016 at 15:09:10 UTC, Andrey wrote:

void moveTo(ref Parameter parent) {


You probably don't want the `ref` there, nor likely on any 
other method definitions (especially check removeValue).


Assuming `Parameter` is a class and not a struct, yes. Be sure to 
check out the crucial distinction between the two in D (reference 
vs. value types, similar to C# class and struct), otherwise you 
won't get far.


Re: A simplification of the RvalueRef idiom

2016-11-22 Thread kink via Digitalmars-d-learn

On Tuesday, 22 November 2016 at 16:05:35 UTC, Satoshi wrote:

Sorry, but D seems to be worse and worse day by day.
This should be resolved by language and not doing it by 
template function.


I hate this 'idiom' too (just a clumsy workaround for something 
that should work out of the box), but the non-bindability of 
rvalues to ref params and the associated dispute is veeery old, 
nothing new, so I don't agree that the language gets worse every 
day. ;)


Re: Visual Studio Linker Problem

2016-10-18 Thread kink via Digitalmars-d-learn

On Tuesday, 18 October 2016 at 05:23:15 UTC, Jason C. Wells wrote:
I am able to compile hello world using dmd2. I am running in 
cygwin because I understand bash way better than cmd.exe.


I bet it works if you invoke LDC outside bash. bash may tamper 
with environment variables, I've had a similiar issue with a bash 
shipped with PortableGit for Windows (C:\... => /C/...).


Re: Fast multidimensional Arrays

2016-08-29 Thread kink via Digitalmars-d-learn
At the very least, give the LDC command line a `-release`, 
otherwise you end up with all assertions enabled etc.


Re: vsprintf or printf variable arguments

2016-08-05 Thread kink via Digitalmars-d-learn

On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain wrote:
How can I construct a va_list for vsprintf when all I have is 
the a list of pointers to the data, without their type info?


A va_list seems to be a packed struct of values and/or pointers 
to the data. While I could construct such a list, 
theoretically, I don't always know when I should store an 
element as a pointer or a value.


e.g., ints, floats, and other value types seems to get stored 
directly in the list, while strings and *other* stuff get 
stored as pointers.


I would be nice if a printf variant listed takes only a pointer 
list to all the values, does anything like this exist?


If not, is there any standardization of what is a value in the 
list and what is a pointer so I can attempt to build the list 
properly?


This has absolutely nothing to do with D as these are C 
functions, so you'd be better off asking this in another forum. 
Anyway, I have no idea why you'd want to construct the va_list 
manually. These vprintf() functions only exist so that other 
variadic functions can forward THEIR varargs - e.g.,


extern(C) void myOldschoolPrintf(in char* format, ...)
{
  doSomethingSpecial();
  va_list myVarargs = va_start(format);
  vprintf(format, myVarargs);
}

Note that va_list is highly platform-dependent, so filling the 
struct manually is a very bad idea.


Re: Confused about referencing in D

2016-07-14 Thread kink via Digitalmars-d-learn

On Thursday, 14 July 2016 at 06:23:15 UTC, Gorge Jingale wrote:
I think that the assignment in the first case is not assigning 
the reference returned by auto ref GetValue().


Yep. There's no such thing as C++ `auto& val = GetValue()` in D. 
You'd have to use a pointer instead: `auto pVal = ()`.


Re: RAII and Deterministic Destruction

2015-08-26 Thread kink via Digitalmars-d-learn
A serious bug affecting RAII is 
https://issues.dlang.org/show_bug.cgi?id=14903, but apparently 
its importance hasn't been properly acknowledged yet. Improving 
the performance of binaries produced by dmd's backend is 
obviously way more important than fixing serious bugs or 
commenting on related PRs.