Thank you.
Actually, I'm doing this: format("%.4f",
d).stripRight('0').stripRight('.') (not so elegant, but it works.)
But I thinking that do not know much about the format string.
On Sunday, 29 March 2015 at 03:29:26 UTC, Baz wrote:
On Friday, 27 March 2015 at 15:02:19 UTC, akaDemik wrote:
T
Thanks for the reply.
I remember about the accuracy of floating point numbers.
It is encouraging that the "%g" can handle it.
format("%.17g", 123456.789123); // == 123456.789123
And we have a flag "#". As mentioned in documentation:
'#' floating Always insert the decimal point and print trailing
On Monday, 30 March 2015 at 02:53:36 UTC, Paul O'Neil wrote:
I'm registering a callback with some C code. The simplified
story is
here, but the actual code is on GitHub [1] at the end if you
care.
The call looks something like this.
void register(void(*fp)(void*), void* context);
I have a c
I'm trying to set environment variables that will be visible when
my D program exits.
It is possible in a windows batch file using the set command
(like set "VAR=VALUE" )
However, running this in D using:
import std.process;
import std.stdio;
void main(){
auto pid1 = spawnShell(`set "VAR=VAL
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote:
Any solutions that people know of?
You can't from an exe, it is a limitation of the operating system
(same on Linux btw, environment variable inheritance is always
from parent to child, never from child to parent). The reason
batch fil
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote:
I'm trying to set environment variables that will be visible
when my D program exits.
It is possible in a windows batch file using the set command
(like set "VAR=VALUE" )
However, running this in D using:
import std.process;
import std.
On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote:
Any solutions that people know of?
You can't from an exe, it is a limitation of the operating
system (same on Linux btw, environment variable inheritance is
always from par
On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote:
It's a DMD Windows bug. It's just been reported 2 days ago:
https://issues.dlang.org/show_bug.cgi?id=14349
so nothing wrong from you side.
Ok, glad to see it's a bug and not a (fairly limiting) feature.
I might take a stab at fixing it, i
On Monday, 30 March 2015 at 13:29:06 UTC, wobbles wrote:
On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote:
Any solutions that people know of?
You can't from an exe, it is a limitation of the operating
system (same on Linux
On 3/30/15 1:42 AM, ketmar wrote:
it's still working. moreover, it is used in Phobos! and yet it's not
documented anywhere. what i want to know is whether they will be removed
for good, or brought back and properly documented? the current situation
is awful: compiler has special treatment for som
On 3/30/15 5:12 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= "
wrote:
On Monday, 30 March 2015 at 02:53:36 UTC, Paul O'Neil wrote:
I'm registering a callback with some C code. The simplified story is
here, but the actual code is on GitHub [1] at the end if you care.
The call looks something like this.
On Mon, 30 Mar 2015 11:25:01 -0400, Steven Schveighoffer wrote:
> On 3/30/15 1:42 AM, ketmar wrote:
>> it's still working. moreover, it is used in Phobos! and yet it's not
>> documented anywhere. what i want to know is whether they will be
>> removed for good, or brought back and properly document
On Monday, 30 March 2015 at 04:05:12 UTC, lobo wrote:
Thank you, lobo.
next version will have equal default LogLevel for all Logger.
https://github.com/D-Programming-Language/phobos/pull/3124
Hi,
Surely I am misunderstanding something.
I got something like this :
struct S
{
void opAssign(const ref s)
{
//...
}
}
S genS()
{
S s;
//...
return s;
}
main()
{
S s;
s = genS();
}
DMD says : ...opAssign (ref const(S) point) is not callable using
a
On Monday, 30 March 2015 at 14:14:50 UTC, Laeeth Isharc wrote:
On Monday, 30 March 2015 at 13:29:06 UTC, wobbles wrote:
On Monday, 30 March 2015 at 12:54:28 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 12:28:19 UTC, wobbles wrote:
Any solutions that people know of?
You can't from an
On Monday, 30 March 2015 at 17:09:14 UTC, matovitch wrote:
(I am gessing ref argument explitly means no rvalue)
That's right. I'd first say don't use ref, just use "const S" and
it will work and probably do what you need efficiently.
If you do want it to be ref though, rvalues aren't allowed
void opAssign(const ref s) should be void opAssign(const ref S s)
btw and btw bis, I should probably make it const ref
SopAssign(const ref S s) :/ I stop flooding there.
You tried setx, and it didn't work ? Or you don't want to set
permanent environmental variables
Yep, correct. Don't want them to be permanent. The systems have
to be clean for other tests at all times, so they need to be on
a shell by shell basis sadly.
Thanks - was curious to know. Laeeth.
The title should be assignement not copy.
same problem. I am preparing string to next SQL request:
string sss = format("SELECT * FROM test.imgs WHERE src LIKE
CONCAT('%', REPLACE(CAST(CURDATE()as char), "-", ""), '%') OR
CONCAT('%', CAST(CURDATE()as char), '%')");
but I am getting next error:
source\app.d(178): Error: invalid array
On Monday, 30 March 2015 at 17:14:27 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 17:09:14 UTC, matovitch wrote:
(I am gessing ref argument explitly means no rvalue)
That's right. I'd first say don't use ref, just use "const S"
and it will work and probably do what you need efficient
On 3/30/15 1:09 PM, matovitch wrote:
Hi,
Surely I am misunderstanding something.
I got something like this :
struct S
{
void opAssign(const ref s)
{
//...
}
}
S genS()
{
S s;
//...
return s;
}
main()
{
S s;
s = genS();
}
DMD says : ...opAssig
On Monday, 30 March 2015 at 17:18:01 UTC, Suliman wrote:
same problem. I am preparing string to next SQL request:
string sss = format("SELECT * FROM test.imgs WHERE src LIKE
CONCAT('%', REPLACE(CAST(CURDATE()as char), "-", ""), '%') OR
CONCAT('%', CAST(CURDATE()as char), '%')");
Here's your
On Monday, 30 March 2015 at 17:20:30 UTC, matovitch wrote:
Yes but you know what they say does it really do a copy of the
struct or is the compiler smart enougth most of the time to
avoid copy. (I think it's called return value optimization).
Copying isn't necessarily a problem, for small stru
On Monday, 30 March 2015 at 17:21:53 UTC, Steven Schveighoffer
wrote:
One solution is to overload
void opAssign(ref const S s) {...}
void opAssign(const S s) {...}
lvalues will go into the ref version, rvalues into the non-ref.
There won't be any copying of data, so you still save a
postblit
string sss = format("foo"-", ""bar");
It should be obvious now that you forgot to escape those double
quotes.
Thanks! Is there any way to stay string as is. without need of
it's escaping and so on?
It's seems I have seen something like it in docs, but I am not
sure about it...
On 3/30/15 1:42 PM, matovitch wrote:
On Monday, 30 March 2015 at 17:21:53 UTC, Steven Schveighoffer wrote:
Annoying as this is (and blatantly awkward), it saves
you from having to implement twice:
void opAssign(T)(auto ref const T s) if(is(T == S)) {...}
Yep, this seems awkward to me too th
On Monday, 30 March 2015 at 17:21:53 UTC, Steven Schveighoffer
wrote:
Annoying as this is (and blatantly awkward), it saves
you from having to implement twice:
void opAssign(T)(auto ref const T s) if(is(T == S)) {...}
Yep, this seems awkward to me too thought according to Adam one
can do :
On Monday, 30 March 2015 at 17:34:20 UTC, Suliman wrote:
string sss = format("foo"-", ""bar");
It should be obvious now that you forgot to escape those
double quotes.
Thanks! Is there any way to stay string as is. without need of
it's escaping and so on?
It's seems I have seen something li
(it's not on line 79 obviously, you got me :D)
Hi again,
I have this simple toy code :
import point;
import std.random;
import std.algorithm;
import std.functional;
void getRandomPoint(R)(R randVar, ref Point p)
{
p.x = randVar;
p.y = randVar;
p.z = randVar;
}
void main()
{
Point[500] points;
auto randVar = un
On Monday, 30 March 2015 at 18:07:18 UTC, matovitch wrote:
kmeans_example.d(79): Error: template
std.algorithm.iteration.map
That error is easy: use points[].map!(test) instead of points.map.
Since points is a static array, it isn't a range. Static arrays
can't be popped through. But if you s
On Monday, 30 March 2015 at 18:23:32 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 18:07:18 UTC, matovitch wrote:
kmeans_example.d(79): Error: template
std.algorithm.iteration.map
That error is easy: use points[].map!(test) instead of
points.map.
Since points is a static array, it i
On Monday, 30 March 2015 at 18:29:32 UTC, matovitch wrote:
I tried importing std.range and points.array works too.
Aye, that would work too, but the slice I think is more efficient
as I'm pretty sure... not completely sure, but I think .array
makes a copy of static arrays, whereas the slice d
On Monday, 30 March 2015 at 18:34:19 UTC, Adam D. Ruppe wrote:
On Monday, 30 March 2015 at 18:29:32 UTC, matovitch wrote:
I tried importing std.range and points.array works too.
Aye, that would work too, but the slice I think is more
efficient as I'm pretty sure... not completely sure, but I
Well I have a bit of a similar problem with foreach.
If I use classic T[] range, I can do :
foreach(int i, auto t, myRange)...
But if I use an Array!T (from std.container) I get :
cannot infer argument types, expected 1 argument, not 2
Even if I add the brackets []. Any idea ? Thanks for your
On Monday, 30 March 2015 at 18:37:53 UTC, matovitch wrote:
On Monday, 30 March 2015 at 18:34:19 UTC, Adam D. Ruppe wrote:
[...]
Aye, that would work too, but the slice I think is more
efficient as I'm pretty sure... not completely sure, but I
think .array makes a copy of static arrays, whereas
On Monday, 30 March 2015 at 19:11:10 UTC, matovitch wrote:
That settle the point for array as for [] ?
I though that was clear. [] doesn't copy.
I guess the documentation should have something to say about it
too. ;)
hopefully
On Monday, 30 March 2015 at 19:08:24 UTC, anonymous wrote:
On Monday, 30 March 2015 at 18:37:53 UTC, matovitch wrote:
On Monday, 30 March 2015 at 18:34:19 UTC, Adam D. Ruppe wrote:
[...]
Aye, that would work too, but the slice I think is more
efficient as I'm pretty sure... not completely sure
Language ref -> Array -> Slice
"An array slice does not copy the data, it is only another
reference to it."
So the total slice of a static array is a range using the
underlying memory of the static array isnt it ?
On Monday, 30 March 2015 at 19:15:25 UTC, matovitch wrote:
Language ref -> Array -> Slice
"An array slice does not copy the data, it is only another
reference to it."
So the total slice of a static array is a range using the
underlying memory of the static array isnt it ?
yes
Thanks. On a sader note, I found a respons'less thread about my
second question :
http://forum.dlang.org/thread/mailman.2247.1353945423.5162.digitalmars-d-le...@puremagic.com
"where std.container.Array is concerned: how come I can't use a
foreach(i, x; myArray) formulation? I.e. one where th
Wow, it's quite old, 2.041.
On Monday, 30 March 2015 at 19:03:05 UTC, matovitch wrote:
Well I have a bit of a similar problem with foreach.
If I use classic T[] range, I can do :
foreach(int i, auto t, myRange)...
But if I use an Array!T (from std.container) I get :
cannot infer argument types, expected 1 argument, not
On Monday, 30 March 2015 at 19:31:54 UTC, anonymous wrote:
On Monday, 30 March 2015 at 19:03:05 UTC, matovitch wrote:
Well I have a bit of a similar problem with foreach.
If I use classic T[] range, I can do :
foreach(int i, auto t, myRange)...
But if I use an Array!T (from std.container) I g
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:
Hi again again,
ulong u = 1 << 63;
Raise :
Error: shift by 63 is outside the range 0..31
This is a bug isn't it, the ulong are supposed to be on 64 bits
? I guess it's time I go to bed.
Have a nice night !
ulong, yes, but 1 is of
Hi again again,
ulong u = 1 << 63;
Raise :
Error: shift by 63 is outside the range 0..31
This is a bug isn't it, the ulong are supposed to be on 64 bits ?
I guess it's time I go to bed.
Have a nice night !
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:
Hi again again,
ulong u = 1 << 63;
Raise :
Error: shift by 63 is outside the range 0..31
This is a bug isn't it, the ulong are supposed to be on 64 bits
? I guess it's time I go to bed.
Have a nice night !
The problem is that `1`
On Monday, 30 March 2015 at 22:34:55 UTC, Vladimir Panteleev
wrote:
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:
Hi again again,
ulong u = 1 << 63;
Raise :
Error: shift by 63 is outside the range 0..31
This is a bug isn't it, the ulong are supposed to be on 64
bits ? I guess i
Brian Schott:
Do this instead:
ulong u = 1L << 63;
I suggest a more explicit:
ulong u = 1UL << 63;
Alternative:
ulong u = 2UL ^^ 63;
Bye,
bearophile
On Monday, 30 March 2015 at 14:01:54 UTC, Alex Parrill wrote:
On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote:
It's a DMD Windows bug. It's just been reported 2 days ago:
https://issues.dlang.org/show_bug.cgi?id=14349
so nothing wrong from you side.
Ok, glad to see it's a bug and not a
was this ever solved?
I did some research and saw static immutable ones suggested a few
times, but they can't be chained AFAIK.
On 03/30/2015 11:32 AM, Steven Schveighoffer wrote:
> On 3/30/15 5:12 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= "
> wrote:
>>
>> `this` is already a reference. You're taking the address of that
>> reference. A simple cast should work: `cast(void*) this`.
>
> To build on this further, &this for a class i
On Tue, 31 Mar 2015 01:40:52 +, weaselcat wrote:
> was this ever solved?
nope. there were some suggestions, but no decision was made.
signature.asc
Description: PGP signature
On Mon, 30 Mar 2015 19:36:49 +, matovitch wrote:
>> The index is the problem. Generally, foreach doesn't do automatic
>> indices for ranges. You can use std.range.enumerate or count yourself
>> explicitly.
>>
>> foreach(i, t; myRange.enumerate) {...}
>>
>> size_t i = 0;
>> foreach(t; myRange)
Hey all,
I am finally working on moving out of dmd territory and playing
with gdc and ldc. I was hoping that I could get some links to
some example command lines. I'm mainly interested command lines
regarding linking to libraries and building static libraries.
My guess is that gdc will funct
On Tuesday, 31 March 2015 at 03:12:42 UTC, ketmar wrote:
On Tue, 31 Mar 2015 01:40:52 +, weaselcat wrote:
was this ever solved?
nope. there were some suggestions, but no decision was made.
sigh
do you know if there's an open enhancement request for this?
On Mon, 30 Mar 2015 11:25:01 -0400, Steven Schveighoffer wrote:
here is ER with patches:
https://issues.dlang.org/show_bug.cgi?id=14382
sorry for breaking my promise of not making ERs anymore. ;-)
signature.asc
Description: PGP signature
On Tue, 31 Mar 2015 05:34:11 +, weaselcat wrote:
> On Tuesday, 31 March 2015 at 03:12:42 UTC, ketmar wrote:
>> On Tue, 31 Mar 2015 01:40:52 +, weaselcat wrote:
>>
>>> was this ever solved?
>>
>> nope. there were some suggestions, but no decision was made.
>
> sigh do you know if there's a
On Tuesday, 31 March 2015 at 04:59:35 UTC, Jeremy DeHaan wrote:
Hey all,
I am finally working on moving out of dmd territory and playing
with gdc and ldc. I was hoping that I could get some links to
some example command lines. I'm mainly interested command lines
regarding linking to libraries
60 matches
Mail list logo