On Thursday, 31 July 2014 at 22:21:10 UTC, Vlad Levenfeld wrote:
Yes, I see the problem now. I can't think of any reason why I'd
want to make save anything but a function (especially since
`save` is a verb) but I guess someone out there might have a
good one.
It's Andrei's fault. I'm not quit
Yes, I see the problem now. I can't think of any reason why I'd
want to make save anything but a function (especially since
`save` is a verb) but I guess someone out there might have a good
one.
So, what is gained by (inout int = 0) over ()? I wasn't even
aware that giving a default value for
On Thursday, 31 July 2014 at 21:50:25 UTC, Eric wrote:
objdump -d -M intel simpleOctal
Not sure what the switches are for;
-d
disassemble - Essential if you want to, well, disassemble.
-M intel
Intel syntax - Because no one likes AT&T syntax. Wikipedia has a
comparison:
http://en.wikipedia.o
There is a solution already for this:
http://dlang.org/phobos/std_file.html#.thisExePath
(just for future reference, it's seriously hard to search on
google)
On Thursday, 31 July 2014 at 20:59:46 UTC, Vlad Levenfeld wrote:
On Thursday, 31 July 2014 at 20:43:11 UTC, bearophile wrote:
Take a look at the asm!
Bye,
bearophile
I use DMD and Dub, how do I view the asm?
Actually I did't think to look at the asm, mainly because
I've never bothered to d
On Thursday, 31 July 2014 at 20:34:42 UTC, Vlad Levenfeld wrote:
What's the rationale behind stating the condition this way as
opposed to, say,
is (typeof(R.init.save)) == R) || is ((typeof(R.init.save()) ==
R)
so that member fields as well as @property and non-@property
methods will match
On Thursday, 31 July 2014 at 20:43:11 UTC, bearophile wrote:
Take a look at the asm!
Bye,
bearophile
I use DMD and Dub, how do I view the asm?
Eric:
Thanks. That really works. I timed doing
auto mySlice = ptr1[0 .. ptr2 - ptr1]; 1,000,000 times
versus
auto mySlice = ptr1[0 .. ptr2 - ptr1].dup; 1,000,000 times
and I am quite convinced the data is not being copied.
Take a look at the asm!
Bye,
bearophile
I've been having trouble propagating range traits for
range-wrapper structs.
Consider this sample code:
struct Wrapper (R)
{
R range;
static if (isInputRange!R)
{
/* input range stuff */
}
static if (isForwardRange!R)
{
On Thursday, 31 July 2014 at 19:28:24 UTC, Marc Schütz wrote:
On Thursday, 31 July 2014 at 18:30:41 UTC, Anonymous wrote:
module test;
import std.stdio;
class buffer(T, size_t sz) {
auto arr = new T[sz];
This allocates an array with `sz` elements once _at compile
time_, places it som
H. S. Teoh:
OK, makes sense. But what about if only the most significant
bit is 1?
Wouldn't that also be an overflow? So you're essentially
checking if the
topmost n bits are zero, where n is the number of bits you wish
to shift by.
Of course.
https://issues.dlang.org/show_bug.cgi?id=13231
On Thursday, 31 July 2014 at 19:43:00 UTC, bearophile wrote:
Eric:
Suppose I have some memory allocated on the heap, and I have
two pointers pointing to the beginning and end of a contiguous
segment
of that memory. Is there a way I can convert those two
pointers
to an array slice without act
Eric:
Suppose I have some memory allocated on the heap, and I have
two pointers pointing to the beginning and end of a contiguous
segment
of that memory. Is there a way I can convert those two pointers
to an array slice without actually copying anything within the
segment?
Use something li
Marc Schütz:
class buffer(T, size_t sz) {
auto arr = new T[sz];
This allocates an array with `sz` elements once _at compile
time_, places it somewhere into the executable, and uses its
address as the default initializer for the member `arr`.
Right. It's not a compiler bug. Dmd/ldc
Suppose I have some memory allocated on the heap, and I have
two pointers pointing to the beginning and end of a contiguous
segment
of that memory. Is there a way I can convert those two pointers
to an array slice without actually copying anything within the
segment?
Thx,
Eric
On Thursday, 31 July 2014 at 18:30:41 UTC, Anonymous wrote:
module test;
import std.stdio;
class buffer(T, size_t sz) {
auto arr = new T[sz];
This allocates an array with `sz` elements once _at compile
time_, places it somewhere into the executable, and uses its
address as the defaul
On Thursday, 31 July 2014 at 18:51:09 UTC, Sean Kelly wrote:
This looks like an optimizer bug. Do you see the same result
with -release set vs. not, etc?
I get it regardless of -release or -O.
Replacing the arr declaration with T[sz] arr; fixes the problem.
This looks like an optimizer bug. Do you see the same result
with -release set vs. not, etc?
module test;
import std.stdio;
class buffer(T, size_t sz) {
auto arr = new T[sz];
enum end = sz-1;
}
void foo(T, size_t sz)() {
auto buf = new buffer!(T,sz);
writeln("before ", buf.arr);
foreach(ref ele; buf.arr) ++ele;
writeln("after ", buf.arr);
Whoops, that is writeln("a ",a.arr); and so on.
On Thu, Jul 31, 2014 at 06:08:56PM +, bearophile via Digitalmars-d-learn
wrote:
> H. S. Teoh:
>
> >What would you check for? Shifting something that already has its
> >high bit set?
>
> If you have a uint where the 3 most significant bits are 1, and you
> shift it 3 bits on the left, you los
H. S. Teoh:
What would you check for? Shifting something that already has
its high bit set?
If you have a uint where the 3 most significant bits are 1, and
you shift it 3 bits on the left, you lose those three bits, you
have an overflow. The point of checkedint functions/intrinsics is
to re
On Thu, Jul 31, 2014 at 05:00:22PM +, bearophile via Digitalmars-d-learn
wrote:
> Is it a good idea to add int/uint/long/ulong functions for the "<<"
> left shift operation here?
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/checkedint.d
[...]
What would you che
On Thu, Jul 31, 2014 at 12:05:52PM +, francesco cattoglio via
Digitalmars-d-learn wrote:
> Really simple question:
> how do I get the compiler-generated hash function for a given type?
>
> For example:
> Struct S
> {
> int i;
> }
>
> can be used in an associative array. That means the co
Is it a good idea to add int/uint/long/ulong functions for the
"<<" left shift operation here?
https://github.com/D-Programming-Language/druntime/blob/master/src/core/checkedint.d
Bye,
bearophile
V Thu, 31 Jul 2014 13:26:38 +
Kagamin via Digitalmars-d-learn
napsáno:
> On Thursday, 31 July 2014 at 12:02:22 UTC, Kozzi11 wrote:
> > module m;
> > @someUda
> > class C {
> > void someFun();
> > }
> >
> > @someUda
> > class D {
> > void anotherFun();
> > }
> >
> > mixin(generateFunDe
On Thursday, 31 July 2014 at 12:05:53 UTC, francesco cattoglio
wrote:
Really simple question:
how do I get the compiler-generated hash function for a given
type?
For example:
Struct S
{
int i;
}
can be used in an associative array. That means the compiler
generates a "toHash" function. I
On Thursday, 31 July 2014 at 12:02:22 UTC, Kozzi11 wrote:
module m;
@someUda
class C {
void someFun();
}
@someUda
class D {
void anotherFun();
}
mixin(generateFunDefForClassesWithSomeUda!m);
This is usually done by generating functions in the classes
directly.
class C {
mixin G
Kozzi11:
Is possible to somehow split class declaration and definition.
I mean something like this:
class C
{
void hello(); // just prototype
}
class C
{
void hello()
{
//actual code
}
}
or something like this
void C.hello() {
//actual code
}
I think this is cur
Really simple question:
how do I get the compiler-generated hash function for a given
type?
For example:
Struct S
{
int i;
}
can be used in an associative array. That means the compiler
generates a "toHash" function. Is there any simple way to call it
directly?
On Thursday, 31 July 2014 at 11:41:07 UTC, FreeSlave wrote:
On Thursday, 31 July 2014 at 11:34:38 UTC, Kozzi11 wrote:
Is possible to somehow split class declaration and definition.
I mean something like this:
class C
{
void hello(); // just prototype
}
class C
{
void hello()
{
On Thursday, 31 July 2014 at 11:34:38 UTC, Kozzi11 wrote:
Is possible to somehow split class declaration and definition.
I mean something like this:
class C
{
void hello(); // just prototype
}
class C
{
void hello()
{
//actual code
}
}
or something like this
void C.hel
Is possible to somehow split class declaration and definition.
I mean something like this:
class C
{
void hello(); // just prototype
}
class C
{
void hello()
{
//actual code
}
}
or something like this
void C.hello() {
//actual code
}
safety0ff:
I modified the Hamming numbers code in a personal exercise.
It now uses considerably less memory but is slower.
I've posted the code here in case it is of use:
http://dpaste.dzfl.pl/3990023e5577
For a single n, n = 350_000_000:
Alternative version 2: 13.4s and ~5480 MB of ram
My c
On Wednesday, 30 July 2014 at 20:51:25 UTC, Daniel Kozak via
Digitalmars-d-learn wrote:
V Wed, 30 Jul 2014 14:33:51 +
seany via Digitalmars-d-learn
napsáno:
In Ali's excllent book, somehow one thing has escaped my
attention, and that it the mentioning of pointer arrays.
Can pointers of
On Thursday, 31 July 2014 at 02:03:37 UTC, Puming wrote:
1. Are AAs reference type? if so, why does the compiler copy it?
This is probably your problem. They are reference types, but
initially that reference is `null`. When you write:
auto cmds = CONFIG.commands;
`cmds` contains a copy
On Thursday, 31 July 2014 at 09:20:28 UTC, Russel Winder via
Digitalmars-d-learn wrote:
Not just at the moment I'm afraid. I'll try and take a look at
it
tomorrow.
Great!
On Thu, 2014-07-31 at 08:40 +, "Nordlöw" via Digitalmars-d-learn
wrote:
> Currently Emacs d-mode cannot correctly highlight
>
> `\`
>
> because it doesn't understand that single backslashes are
> self-contained in back-quoted strings.
>
> I believe this extract from d-mode.el
>
> (defvar d
Currently Emacs d-mode cannot correctly highlight
`\`
because it doesn't understand that single backslashes are
self-contained in back-quoted strings.
I believe this extract from d-mode.el
(defvar d-mode-syntax-table nil
"Syntax table used in d-mode buffers.")
(or d-mode-syntax-table
(
39 matches
Mail list logo