On Thursday, 19 September 2019 at 11:16:12 UTC, Simen Kjærås
wrote:
Might I ask what specifically you're working on?
Of course. It's about issue 15881 (and 15763), namely approxEqual
not always doing, what people think it should do. (As a side
note: I stumbled over this, when I wanted to file
On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås
wrote:
That does indeed fail to compile, and there's no easy way to
introduce the module-level abs() function to the scope. Again
though, MergeOverloads to the rescue:
I'm not sure, if MergeOverloads will be accepted into std/math.d.
On Wednesday, 18 September 2019 at 13:57:53 UTC, ag0aep6g wrote:
You're probably hitting this issue:
https://issues.dlang.org/show_bug.cgi?id=19116
Yes, sounds similar. I tried PR 9981, but that didn't work on my
machine. Similar message, just an other file, that cannot be
compiled (dmd/backe
On Wednesday, 18 September 2019 at 12:37:28 UTC, Simen Kjærås
wrote:
How to resolve this, though? The simplest solution is to not
use selective imports:
import std.math;
import std.complex;
writeln(abs(complex(1.0,1.0)));
writeln(abs(1.0));
That works. But: I'm trying to writ
The following code doesn't compile:
import std.stdio;
void main()
{
import std.complex: abs, complex;
import std.math: abs;
auto a = complex(1.0,1.0);
auto b = 1.0;
writeln(abs(a));
writeln(abs(b));
}
The error message depends on the order of the two import
statements. Se
On Wednesday, 18 September 2019 at 11:25:21 UTC, Norm wrote:
I usually do something like the following:
Ah great. I was looking for "is(T == Complex!R, R)". :-) Thanks!
Is it possible to simplfy this?
static if (is (T==Complex!double) || is (T==Complex!float) || is
(T==Complex!real))
On Tuesday, 17 September 2019 at 18:13:06 UTC, Adam D. Ruppe
wrote:
Did you make sure the old version was totally uninstalled
before the new version was attempted to be built? This thing
often happens because of a compiler/runtime version mismatch,
typically because the old version didn't get f
I'm not sure, if this is the right place to ask, but I couldn't
find a better one either.
I'm trying to install D on my old 32-bit machine (debian stable).
First I tried to install a precompiled version and now I followed
[1]. In both cases, I always get a segmentation fault when I try
to run
On Wednesday, 11 September 2019 at 09:05:47 UTC, Ali Çehreli
wrote:
Like this?
Yet an other template! That's great! :-)
I'd like to write a template, that takes a different default
value depending on the type of a variable. I tried this, but it
doesn't work:
void main()
{
double a = 1e-8;
double b = 1e-10;
float c = 1e-4;
float d = 1e-6;
assert(!test(a));
assert(test(b));
assert(!test(c));
On Sunday, 8 September 2019 at 10:04:57 UTC, Joel wrote:
I'm trying to understand delegates. Is there any good ways I
can get a better understanding of them?
I wrote a foreach loop using opApply. A side effect of that was,
that after I managed to do this I understood delegates. :-)
On Friday, 6 September 2019 at 08:47:07 UTC, Kagamin wrote:
Physical objects work like reference types. A place on
bookshelf is at one coordinate and a book is at another
coordinate, you don't copy the book, you fill a place on
bookshelf with a reference to the book.
So it's more like a piece
On Thursday, 5 September 2019 at 21:22:12 UTC, Ali Çehreli wrote:
If it makes for the type to have immutable (or const) members,
then fine; with the understanding that objects of that type
cannot be assigned or mutated any other way, we can define them
like that. What I meant is, because we wan
On Thursday, 5 September 2019 at 20:10:03 UTC, ag0aep6g wrote:
You're not putting an immutable int into an AA. You're copying
the value of an immutable int to a mutable one.
but I can't do that with a struct, having an immutable member.
When I remove that immutable inside of the struct it work
On Thursday, 5 September 2019 at 15:48:40 UTC, Ali Çehreli wrote:
That's the misunderstanding: The existing object is assigned
over. The address is the same:
void main() {
int[int] aa;
aa[1] = 1;
const oldPointer = (1 in aa);
aa[1] = 11;
assert(oldPointer is (1 in aa)); // Passes
}
On Thursday, 5 September 2019 at 13:27:55 UTC, drug wrote:
[...]when you put it into an AA you modify old value
Why?!? :-o When putting it into an AA it will be copied to a
different place in memory, but the value is still the same, it's
not modified. Sorry, but I still think, there is someth
On Thursday, 5 September 2019 at 12:15:51 UTC, drug wrote:
One solution could be using either pointer to `const(Point)` or
class here (to avoid pointer using)
https://run.dlang.io/is/rfKKAJ
OK. This are two solutions and although I'll probably not going
to use any of those (due to other reaso
On Thursday, 5 September 2019 at 11:22:15 UTC, drug wrote:
05.09.2019 14:17, berni пишет:
Point[long] q;
q[1] = Point(3);
Leads to:
test.d(7): Error: cannot modify struct q[1L] Point with
immutable members
But why do you try to modify immutable data? What is your
point? Could you descri
On Thursday, 5 September 2019 at 10:47:56 UTC, Simen Kjærås wrote:
https://dlang.org/library/std/range/retro.html
Yeah, that worked. Thanks. :-)
Don't worry about asking questions
OK. Then here's the next one:
Point[long] q;
q[1] = Point(3);
Leads to:
test.d(7): Error: cannot modify s
On Thursday, 5 September 2019 at 08:56:42 UTC, berni wrote:
[..]
And one more question:
import std.algorithm: reverse;
writeln(q.reverse);
Here the compiler complains with:
test.d(8): Error: template std.algorithm.mutation.reverse
cannot deduce function from argument types !()(Point[]),
On Thursday, 5 September 2019 at 08:44:35 UTC, berni wrote:
This doesn't compile:
[...]
Any idea, how to get around this?
Found the answer myself: q.map!(a=>a.x).minElement; :-)
On Thursday, 5 September 2019 at 08:16:08 UTC, Daniel Kozak wrote:
in this case you can just use:
auto q = cast()p.x;
Ahh, great! :-)
But that directly gets me to the next question:
import std.stdio;
void main()
{
Point[] q = [Point(1),Point(3),Point(2)];
import std.algorithm.sear
I still struggle with the concept of immutable and const:
import std.stdio;
void main()
{
auto p = Point(3);
auto q = p.x;
writeln(typeof(q).stringof);
}
struct Point
{
@property immutable long x;
}
The type of q is immutable(long). But I need a mutable q. I found
two ways:
On Tuesday, 3 September 2019 at 20:06:27 UTC, Ferhat Kurtulmuş
wrote:
I know, it is foreach loop in question. How about using a
reverse for loop like:
for (size_t i = arr.length ; i-- > 0 ; ){
arr.remove(i);
}
This would be good, if it where for slices. But with associative
arrays, this
On Monday, 2 September 2019 at 14:20:11 UTC, Paul Backus wrote:
If you have an existing delegate that you want to use with
opApply, the easiest way is like this:
void delegate(Thing) myDelegate = ...;
foreach(thing; things) {
myDelegate(thing);
}
// Equivalent to: things.opApply((Thing t)
I've tried to make a small example, but it's not easy to get this
reduced further. At least I didn't manage. The following program
can also be found at https://run.dlang.io/is/p6l7xN
void main()
{
auto foo = Ways([Way([8,2,3,0]),Way([4,6,2]),Way([4,7,2,6])]);
foo.remove_odds();
as
On Friday, 30 August 2019 at 15:00:59 UTC, Paul Backus wrote:
Whether you actually get an error at runtime depends on the
load factor of the AA. If it drops below a certain threshold,
the AA will be resized [1], and its original memory will be
freed [2].
It could still work, depending on how
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA, I've
got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you agree? Or is there a better way to achieve this?
On Tuesday, 27 August 2019 at 16:25:00 UTC, Samir wrote:
As I've mentioned on the list before, I really struggle to
understand how some of the std.algorithm functions such as
`map` work when combined with things like `array`, `sort` and
especially `zip` but really appreciate the support I find
On Tuesday, 27 August 2019 at 16:45:53 UTC, Samir wrote:
I never understood why the intial value of floats, doubles and
reals was NaN.
That's for detecting uninitialised variables. If the result of a
calculation is NaN, it's likely, that you forgot to initialise
the variable.
import std.stdio;
void main()
{
real[int] a;
a[0] += 100;
writeln(a);
}
results (independed of the used compiler) in
[0:100]
I was a little bit surprised, because a[0] += 100 should be the
same as a[0] = a[0]+100, which leads to a range violation error.
Furthermore, as we work
On Monday, 26 August 2019 at 09:14:23 UTC, Jonathan M Davis wrote:
The dot makes it so that it's specifically referencing a
module-level symbol (be it in that module or an imported
module) instead of a local or member symbol.
Ah, thanks. Now it makes sense! :)
Out of curiosity: Browsing the source of stdio.d I found that
flush() is implemented by calling fflush from some C++ library.
What I don't understand: Why is the call to fflush preceded by a
dot?
On Saturday, 24 August 2019 at 19:55:48 UTC, a11e99z wrote:
auto ab = a.byPair.chain( b.byPair).assocArray ?
Not sure, if it is simpler, but a least without tmp. :) Thanks.
I've got two associative arrays and want to get a new one, which
is created out of both of them:
This works:
string[int] a = [1:"one", 7:"seven"];
string[int] b = [5:"five", 9:"nine"];
string[int] tmp = a.dup;
foreach (k,v;b) tmp[k] = v;
assert(tmp==[1:"one", 7:"seven", 5:"five", 9:"nine"]);
I've got a function which takes two strings and should return
them as a ubyte[] with additional zero bytes in between and
around. This works:
ubyte[] convert_string_pair(string first, string second)
{
auto b = new ubyte[](0);
b ~= 0x00 ~ first ~ 0x00 ~ second ~ 0x00;
On Friday, 2 August 2019 at 14:05:20 UTC, SashaGreat wrote:
On Friday, 2 August 2019 at 12:28:45 UTC, berni wrote:
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote:
Should I go for C and then when I become a better programmer
change to D?
Should I start with D right now?
In my opp
On Thursday, 1 August 2019 at 21:26:10 UTC, Matt wrote:
Anyone have any other thoughts?
I tried to simplify your example a little bit:
import std.stdio;
import std.range;
import std.algorithm;
auto myFilter(R1, R2)(R1 a, R2 b)
{
return a.filter!(c => c==b.front);
}
struct A
{
int[] s
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote:
Should I go for C and then when I become a better programmer
change to D?
Should I start with D right now?
In my oppinion C should have been deprecated about 50 years ago
and it's not worth while to learn it if you are not intereste
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote:
Should I go for C and then when I become a better programmer
change to D?
Should I start with D right now?
In my oppinion C should have been deprecated about 50 years ago
and it's not worth while to learn it if you are not intereste
Hurray, it works! :-)
https://run.dlang.io/is/2GMq34
I have to use classes to avoid copying when arguments are passed
to a function. (And yes, there should of course be much more
checks, especially when there are to few elements in the original
range. And it could be speed improved and so on.
On Sunday, 7 July 2019 at 21:55:17 UTC, Jonathan M Davis wrote:
Having one range know about the other isn't enough. That just
means that the take range would tell the other range that it
had popped an element off, and then the other would know that
it had to pop an element off. That still invol
On Sunday, 7 July 2019 at 09:01:53 UTC, Jonathan M Davis wrote:
Without slicing, that's impossible without iterating over the
elements multiple times.
That's what I thought too, but meanwhile I think it is possible.
To get it working, the second range needs to know about the first
one and whe
I start to understand: A (lazy) range is something like a
voucher: byChunk() does not provide the data immediately, but
only a voucher to hand you a chunk (an array of 2 bytes in my
example above) a time. This voucher is passed to joiner(), which
keeps that voucher and hands me out a new vouche
On Saturday, 6 July 2019 at 14:48:04 UTC, Adam D. Ruppe wrote:
[...]
So this is a case of input range behavior - always consuming
the underlying file - combined with buffering of two elements
at once, leaving 5,6 behind, and the reuse of the buffer
meaning you see that 5,6 again on the next ca
A small example showing this strange behaviour:
import std.stdio;
import std.algorithm.iteration;
import std.range;
enum BUFFER_SIZE = 1024;
void main(string[] args)
{
auto a = (new File(args[1]))
.byChunk(BUFFER_SIZE)
.joiner;
writeln(a.take(5));
writeln(a);
}
Using
Now it's getting weird. Meanwhile I encountered, that take()
sometimes consumes and sometimes not. Where can I learn, what is
the reason behind this behavior? And how can I handle this?
Now I found this:
https://forum.dlang.org/thread/eobdqkkczquxoepst...@forum.dlang.org
Seems to be intentional, that this doesn't work. In my case I'm
able to move d() into the outer struct...
On Saturday, 6 July 2019 at 11:48:51 UTC, a11e99z wrote:
sure
auto take_consuming( R )( ref R r, int cnt ) {
auto tmp = r.take( cnt ).array;
r = r.drop( cnt );
return tmp;
}
don't thank
Doesn't look like what I'm looking for, as it is exactly the same
I allready found.
Maybe I ne
On Thursday, 4 July 2019 at 17:00:33 UTC, Q. Schroll wrote:
The prime example is printing the comma when printing a list:
There is one between any two elements, but neither is one at
front or behind the last one.
If it is just for printing commas in between, you can use
range.join(", ")
htt
struct A
{
void c() {}
struct B
{
void d()
{
c();
}
}
}
When compiling this with rdmd I get the message: "Error: this for
c needs to be type A not type B". Is there a way to call c from d?
I want to copy the first n items of a range to an array, removing
these items from the range.
This works:
foreach (i;0..n)
{
data ~= r.front;
r.popFront();
}
but looks a little bit arkward.
I came up with this now:
data = r.take(n).array;
This works partly, because the values of r
On Friday, 5 July 2019 at 18:45:01 UTC, Les De Ridder wrote:
On Friday, 5 July 2019 at 18:29:36 UTC, berni wrote:
On Friday, 5 July 2019 at 17:57:39 UTC, Les De Ridder wrote:
File.byChunk[1] should do the trick.
[1] https://dlang.org/library/std/stdio/file.by_chunk.html
Not sure, if this is,
On Friday, 5 July 2019 at 17:57:39 UTC, Les De Ridder wrote:
File.byChunk[1] should do the trick.
[1] https://dlang.org/library/std/stdio/file.by_chunk.html
Not sure, if this is, what I'm looking for. I'd like to do
something like
buffered_file.map!(a=>2*a).writeln();
When I understand i
I'd like to process a (binary) file as a buffered InputRange but
I havn't found anything yet. Is there anything or do I have to
write it on my own?
On Tuesday, 18 December 2018 at 14:32:29 UTC, Adam D. Ruppe wrote:
CTFE is used if and only if it MUST be used by context. That's
a runtime function, so no ctfe.
Do something like:
int[4] generate() {
int[4] tmp;
foreach(i; 0..4) tmp[i] = i;
return tmp;
}
static immutable int[4] clu
On Tuesday, 18 December 2018 at 13:53:01 UTC, Stefan Koch wrote:
Why would you need to know?
Well, first out of curiosity. But there are also other reasons:
I've got a large immutable array. Without CTFE I'd use some php
script and add it as a large literal. With CTFE I don't need that
php s
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is also executed at compile time,
when
I've got a lot of code with two-dimensional arrays, where I use
stuff like:
assert(matrix.all!(a=>a.all!(b=>b>=0)));
Does anyone know if there is a 2D-version of all so I can write
something like:
assert(matrix.all2D!(a=>a>=0));
I've got the following code, which works, but obviously contains
duplication. Is there a way to move that
"dissection_available?...:..." to the place, where it should be?
return dissection_available
?solution.dup
.transposed.map!(a=>a.map!(b=>"?#."[b]).array)
.zi
On Saturday, 22 September 2018 at 12:52:45 UTC, Steven
Schveighoffer wrote:
It was suggested when transposed was fixed to include opIndex,
but never implemented.
Maybe I'm too naive, but isn't it easy to implement it just the
same way, it is done with transverse? That is: putting the
"static
I expect this small program to throw an Exception:
import std.stdio;
import std.range;
void main()
{
auto a = [[1,2],
[4,5,3]];
a.transposed!(TransverseOptions.enforceNotJagged).writeln;
}
But it just outputs:
[[1, 4], [2, 5], [3]]
Is it a bug or is it me who's doin
On Thursday, 20 September 2018 at 14:10:44 UTC, Steven
Schveighoffer wrote:
Hm... 2.079.0 had it:
Sorry, I made a mistake while testing and after I found out, that
it was not available in the documentation at dpldocs.info I
concluded, that it must be a really new feature. But now it seems
to
On Thursday, 20 September 2018 at 07:36:06 UTC, Paul Backus wrote:
Looks like `Config.stderrPassThrough` [1] should do what you
want:
const result = execute(args[1..$], null,
Config.stdErrPassThrough);
[1]
https://dlang.org/phobos/std_process.html#.Config.stderrPassThrough
In theory t
I need to execute a program and capture stdout, which I hoped
std.process.execute would do. But unfortunatly this command also
captures stderr, which I need to be ignored. When looking at the
implementation of std.process.execute I see, that I can probably
do this by removing "Redirect.stderrTo
The problem is more general: you can only use top-level symbols
in UFCS.
You can use an identity alias template to bypass this:
https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/
(search for UFCS in the page).
Good to know. :-)
The following program does not compile:
import std.stdio;
import std.algorithm;
struct A
{
struct S
{
int x;
}
const bool foo(in S s, in int k)
{
return s.xa.foo(3)).writeln;
}
}
void main()
{
A().bar();
}
I get (using rdmd):
test.d(18): Error: no proper
Can you post a complete, runnable example that illustrates your
problem?
Strange as it is, now it works here too... - I don't know, what
went wrong yesterday. Thanks anyway. :-)
Anotherone I'm not getting to work: From some output with
newlines I want to discard all lines, that start with a # and
select part of the other lines with a regex. (I know the regex
r".*" is quite useless, but it will be replaced by something more
usefull.)
I tried the following, but non wor
On Saturday, 15 September 2018 at 03:25:38 UTC, Paul Backus wrote:
On Friday, 14 September 2018 at 20:43:45 UTC, SrMordred wrote:
What you want is std.range.chunks
auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];
a.map!(to!string)
.join("")
.chunks(4)
.map!(to!string) //don´t know why
a) I've got an int[] which contains only 0 und 1. And I want to
end with a string, containing 0 and 1. So [1,1,0,1,0,1] should
become "110101". Of course I can do this with a loop and ~. But I
think it should be doable with functional style, which is
something I would like to understand better.
I've got the folling function which returns a RegexMatch!string:
auto extract_list(const string entry)
{
// check if entry is valid
return matchAll(entry, some_regex);
}
I call this function using enforce(extract_list(some_argument)).
I think, that enforce is quite useless in this ve
On Thursday, 22 March 2018 at 16:22:04 UTC, Ali Çehreli wrote:
Never thought of it before. :) I would put all that code into a
function and call from the out block.
I rejected this, because I've got an unease feeling using extra
functions in contract programming. Can't tell, where this feeling
Part of my code looks like this:
out (result)
{
if (result==true)
{
lots of assertions...
}
}
I would prefer an early exit like:
out (result)
{
if (result==false) return;
lots of assertions...
}
Is this possible somehow (return and break don't do the job...).
The only thing
On Saturday, 4 March 2017 at 10:02:15 UTC, Johan Engelen wrote:
If you think you have a good testcase, it's nice for compiler
devs like me to open a new thread about the difference that you
found between the compilers (so that we can try and improve
things).
I'm not sure, if my "testcase" is
On Friday, 3 March 2017 at 20:10:25 UTC, Ali Çehreli wrote:
Which would put gdc in between the two. Is your experience
different?
Actually, I've got not much experience. A few weeks ago I ran a
test where ldc was in between dmd and gdc. But I missed the
-release flags then. With that flag it'
On Friday, 3 March 2017 at 13:21:56 UTC, Seb wrote:
Is there any specific reason why you can't use DMD or LDC?
gdc produces faster binaries. ;-) I've got installed the other
two compilers too and they work.
On Thursday, 2 March 2017 at 09:13:40 UTC, berni wrote:
Just a note: I now asked the same question on the cmake mailing
list. Maybe, it's the better place to do so...
After some help of cmake people and a morning of more
investigations, I'm quite sure I found a bug in gdc. Meanwhile
I've got
On Tuesday, 28 February 2017 at 17:09:28 UTC, berni wrote:
I'm using CMAKE to build my project. [...]
Just a note: I now asked the same question on the cmake mailing
list. Maybe, it's the better place to do so...
I'm using CMAKE to build my project. With
https://github.com/dcarp/cmake-d this works almost. The only
thing I do not manage to get working is running cmake in release
mode. When I use -DCMAKE_BUILD_TYPE=Release I get some linker
errors, which I do not get, when compiling manually. (In both
ca
On Thursday, 23 February 2017 at 17:44:05 UTC, HeiHon wrote:
Generally postscript files may contain binary data.
Think of included images or font data.
So in postscript files there should normally be no utf-8
encoded text, but binary data are quite usual.
Think of postscript files as a sequence
On Wednesday, 22 February 2017 at 21:23:45 UTC, H. S. Teoh wrote:
enforce(!s.any!"a > 127");
Puh, it's lot's of possibilities to choose of, now... I thought
of something like the foreach-loop but wasn't sure if that is
correct for all utf encodings. All in all, I think I take the
any
As I cannot find any PM-feature in this forum and don't know how
to contact you else, I'm hijacking this thread to give you some
feedback...
On Friday, 17 February 2017 at 19:16:44 UTC, Adam D. Ruppe wrote:
Yes, that is my documentation fork, it has a search feature if
you do dpldocs.info/some
In my program, I read a postscript file. Normal postscript files
should only be composed of ascii characters, but one never knows
what users give us. Therefore I'd like to make sure that the
string the program read is only made up of ascii characters. This
simplifies the code thereafter, becaus
On Monday, 20 February 2017 at 13:48:30 UTC, ketmar wrote:
anyway, in my real-life code inlining never worth the MASSIVELY
increased compile times: speedup is never actually noticeable.
if "dmd -O" doesn't satisfy your needs, there is usually no
reason to trying "-inline", it is better to switc
On Sunday, 19 February 2017 at 20:00:00 UTC, Daniel Kozak wrote:
Dne 19.2.2017 v 20:19 berni via Digitalmars-d-learn napsal(a):
Is it possible to force a function to be inlined?
Comparing a C++ and a D program, the main difference in speed
(about 20-30%) is, because I manage to force g++ to
Is it possible to force a function to be inlined?
Comparing a C++ and a D program, the main difference in speed
(about 20-30%) is, because I manage to force g++ to inline a
function while I do not find any means to do the same on D.
On Sunday, 19 February 2017 at 10:15:49 UTC, rikki cattermole
wrote:
What's wrong here?
void main()
{
A bar = cast(A)Object.factory(__MODULE__ ~ ".AA");
bar.foo();
}
Oops. I overdid when trying to create a small example. With the
module it works, but my original program had the module
I get a segmentation fault, when I run this program:
void main()
{
A bar = cast(A)Object.factory("AA");
bar.foo();
}
class A{ abstract void foo(); }
class AA:A { override void foo() {} }
The call of bar.foo() is, where the segmentation fault occurs.
When I use A bar = new AA(); ins
I'm new here too (never heard of D before 2017).
c). The whole community seems infused with both the Feminism/SJW
I didn't tried out Rust, but that would draw me away too.
(Incidentally it was a comment on alternatives for Rust, that
pointed me to D.)
2. I am also curious as to what would
Just a note - I found something, that works:
import std.stdio;
void main(string[] args)
{
immutable cond = args[1]=="a";
if (cond) write("A");
scope (exit) if (cond) write("B");
write("C");
}
I'm using the immutable variable to avoid, that the condition
changes later.
I wonder if it's possible to do something like this:
import std.stdio;
void main(string[] args)
{
if (args[1]=="a")
{
write("A");
scope (exit) write("B");
}
write("C");
}
I expected the output to be ACB not ABC. I understand, that the
scope ends at the end of the i
On Friday, 17 February 2017 at 19:16:44 UTC, Adam D. Ruppe wrote:
Yes, that is my documentation fork, it has a search feature if
you do dpldocs.info/some_term and it tries to be easier to read
and navigate, let me know how you like it!
What I've seen so far, looks quite good.
What I didn't un
On Friday, 17 February 2017 at 16:08:11 UTC, Adam D. Ruppe wrote:
Try
fileno(core.stdc.stdio.stderr);
to force it to use the C stderr object instead of the D one.
Alternatively, fileno(stderr.getFP()) should do it too.
http://dpldocs.info/experimental-docs/std.stdio.File.getFP.html
Many than
Something similar happend now, but this time it works with dmd
and rdmd produces the error:
The command that works is
dmd a.d b.o
where b.o is a precompiled c file, similar to
https://github.com/dlang/druntime/blob/master/src/core/stdc/errno.c
When using rdmd it doesn't work anymore. When I
The following code doesn't work:
int no = fileno(stderr);
The error message is:
test.d(7): Error: function core.stdc.stdio.fileno
(shared(_IO_FILE)*) is not callable using argument types (File)
How can I cast stderr to something, that fileno() accepts?
On Wednesday, 15 February 2017 at 15:58:41 UTC, Jonathan M Davis
wrote:
[...]
MonoTime before = MonoTime.currTime;
Thread.sleep(dur!"msecs"(1000));
MonoTime after = MonoTime.currTime;
Duration timeElapsed = after - before;
writeln(timeElapsed);
}
```
I get: "1 sec, 26 μs
On Wednesday, 15 February 2017 at 16:11:36 UTC, drug wrote:
No, you recursively call main() and get segfault (due to stack
overflow) as expected
I thought, that an stack overflow leeds to an exception. But
that's not true, as I now see. Thanks for your answer.
I'm not sure if this is considered a bug:
import std.stdio;
import std.string;
int c = 0;
void main()
{
try {
write(++c," ");
stdout.flush();
int[10] tmp;
throw new Exception(format("%s",tmp));
} finally
{
main();
}
}
Output:
1 2 3 4 5 6 7
1 - 100 of 111 matches
Mail list logo