Am Sat, 22 Nov 2014 18:30:05 +
schrieb "Ad" :
> Hello, I would like to write a "popcnt" function. This works fine
>
> ulong popcnt(ulong x)
> {
> asm { mov RAX, x ; popcnt RAX, RAX ; }
> }
>
> However, if I add the "naked" keyword ( which should improve
> performance? ) it doesn't work anym
On 11/23/2014 3:52 AM, Paul wrote:
Whenever I try to learn a new language I always seem to end up fighting
the OS or the IDE rather than spending time where I should. Therefore,
I'm going to put this idea on hold and stick to console programs for a
while (tried to install ncurses as well earlier
On Saturday, November 22, 2014 14:59:58 Eric via Digitalmars-d-learn wrote:
> On Saturday, 22 November 2014 at 09:57:55 UTC, anonymous wrote:
> > On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
> >> I know I can make a class immutable, but the problem is I want
> >> to constrain a templa
ketmar:
there were some debates about locals that
shadows fields and how that can introduce some hard-to-catch
bugs.
I told ya.
Bye,
bearophile
On Sat, Nov 22, 2014 at 11:54:01PM +0200, ketmar via Digitalmars-d-learn wrote:
> On Sat, 22 Nov 2014 20:57:05 +
> WhatMeWorry via Digitalmars-d-learn
> wrote:
>
> > auto bottom = NestedBottom(2, ['d','o','g']);
> ah, that good old thingy! there were some debates about locals that
>
On Sat, 22 Nov 2014 20:57:05 +
WhatMeWorry via Digitalmars-d-learn
wrote:
> auto bottom = NestedBottom(2, ['d','o','g']);
ah, that good old thingy! there were some debates about locals that
shadows fields and how that can introduce some hard-to-catch bugs.
you were hit by exactly th
On Saturday, 22 November 2014 at 20:57:07 UTC, WhatMeWorry wrote:
auto bottom = NestedBottom(2, ['d','o','g']);
That 'auto' is the problem. You want 'this.bottom = ...' instead.
On Saturday, 22 November 2014 at 18:30:06 UTC, Ad wrote:
Hello, I would like to write a "popcnt" function. This works
fine
ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}
However, if I add the "naked" keyword ( which should improve
performance? ) it doesn't work anymore and I
// Two simple value type structures. one embedded in the other.
I've stepped through the debugger and I see the embedded
structure being set to 2, and dog.
import std.stdio;
struct NestedBottom
{
int i;
char[3] fixedArray;
// this(){} no-argument ctor can only be defined by th
But I'm not sure if maybe I changed to much about it.
My point is, that I think it's generally a good idea to be
flexible when possible, and not make (im)mutability demands
unless actually necessary.
You may know the following, but I feel like there may be some
confusion about it: Note that im
On Friday, 21 November 2014 at 01:23:55 UTC, Mike Parker wrote:
On 11/21/2014 10:22 AM, Mike Parker wrote:
You are adding anything
You /aren't/
The problem is 'no available video device' when trying to init
SDL. I've recently wiped/re-installed this machine so something
must be missing. I
Hello, I would like to write a "popcnt" function. This works fine
ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}
However, if I add the "naked" keyword ( which should improve
performance? ) it doesn't work anymore and I can't figure out
what change I am supposed to make ( asid
On Saturday, 22 November 2014 at 17:40:42 UTC, Eric wrote:
Yes, but this is what I really want:
class X(T : immutable Object)
{
private T x;
this(T x) pure { this.x = x; }
}
class Y
{
private int x;
this(int x) pure { this.x = x; }
}
void main()
{
immutable(Y) y = new immut
On Saturday, 22 November 2014 at 17:06:29 UTC, anonymous wrote:
On Saturday, 22 November 2014 at 15:00:00 UTC, Eric wrote:
Yes, but if I don't declare the class T as immutable, I don't
think this constraint will work.
You're mistaken. It works just fine.
class X /* not immutable */
{
pri
On 22.11.2014 21:22, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 20:05:13 +0400
drug via Digitalmars-d-learn wrote:
Does it worth to make some compiler option that for example prohibits
passing static array instead of dynamic one without slicing? Who has a
lot of breakable correc
On Sat, 22 Nov 2014 20:05:13 +0400
drug via Digitalmars-d-learn wrote:
> Does it worth to make some compiler option that for example prohibits
> passing static array instead of dynamic one without slicing? Who has a
> lot of breakable correct D code doesn't use it, but others do if they want?
W
On Saturday, 22 November 2014 at 15:00:00 UTC, Eric wrote:
Yes, but if I don't declare the class T as immutable, I don't
think this constraint will work.
You're mistaken. It works just fine.
class X /* not immutable */
{
private int x;
this(int x) pure { this.x = x; }
}
template foo(
On 22.11.2014 20:30, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 08:07:31 -0800
"H. S. Teoh via Digitalmars-d-learn"
wrote:
On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn wrote:
On 22.11.2014 20:26, Eric wrote:
On Saturday, 22 November 2014 at 16:07:25 UTC, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learn wrote:
I tried to pass pointer to static array but it didn't work.
i tried it
On 22.11.2014 20:47, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 19:07:14 +0400
drug via Digitalmars-d-learn wrote:
Sorry for inconvenience.
http://dpaste.dzfl.pl/64ab69ae80d2
this causes stackoverflow because static array is big enough. I'd like
to pass it not by value to avoid
On Sat, 22 Nov 2014 19:07:14 +0400
drug via Digitalmars-d-learn wrote:
> Sorry for inconvenience.
> http://dpaste.dzfl.pl/64ab69ae80d2
> this causes stackoverflow because static array is big enough. I'd like
> to pass it not by value to avoid stack overflowing. Even if I use ref
> dmd pass it b
On 22.11.2014 20:26, Ali Çehreli wrote:
On 11/22/2014 07:07 AM, drug wrote:
> On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
>> On Sat, 22 Nov 2014 18:20:44 +0400
>> drug via Digitalmars-d-learn wrote:
>>
>>> I tried to pass pointer to static array but it didn't work.
>> i trie
On Sat, 22 Nov 2014 08:07:31 -0800
"H. S. Teoh via Digitalmars-d-learn"
wrote:
> On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn
> wrote:
> > On Sat, 22 Nov 2014 15:45:51 +
> > Eric via Digitalmars-d-learn wrote:
> >
> > > Maybe this is not so lame because change()
On 11/22/2014 07:07 AM, drug wrote:
> On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
>> On Sat, 22 Nov 2014 18:20:44 +0400
>> drug via Digitalmars-d-learn wrote:
>>
>>> I tried to pass pointer to static array but it didn't work.
>> i tried it right now and it works.
>>
>> if you real
On Saturday, 22 November 2014 at 16:07:25 UTC, drug wrote:
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via
Digitalmars-d-learn wrote:
I tried to pass pointer to static array but it didn't work.
i tried it right now and it works.
if yo
On 22.11.2014 19:34, ketmar via Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learn wrote:
I tried to pass pointer to static array but it didn't work.
i tried it right now and it works.
if you really want to get some help, you'd better give us something
On Saturday, 22 November 2014 at 15:57:40 UTC, ketmar via
Digitalmars-d-learn wrote:
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn
wrote:
Maybe this is not so lame because change() can take
any length of static array.
void change (int[] arr) {
arr[1] = 42;
}
vo
On Sat, Nov 22, 2014 at 05:57:30PM +0200, ketmar via Digitalmars-d-learn wrote:
> On Sat, 22 Nov 2014 15:45:51 +
> Eric via Digitalmars-d-learn wrote:
>
> > Maybe this is not so lame because change() can take
> > any length of static array.
>
> void change (int[] arr) {
> arr[1] = 42;
On Sat, 22 Nov 2014 15:45:51 +
Eric via Digitalmars-d-learn wrote:
> Maybe this is not so lame because change() can take
> any length of static array.
void change (int[] arr) {
arr[1] = 42;
}
void main () {
int[$] a = [1, 2, 3];
change(a);
import std.stdio : writeln;
On Saturday, 22 November 2014 at 15:20:55 UTC, drug wrote:
I tried to pass pointer to static array but it didn't work.
Also, if you really want to be lame and actually use a pointer
try this:
import std.stdio;
void change(int *arr)
{
arr[1] = 6;
}
void main()
{
int[3] a = [1, 2, 3];
On Saturday, 22 November 2014 at 15:20:55 UTC, drug wrote:
I tried to pass pointer to static array but it didn't work.
try this:
import std.stdio;
void change(ref int[3] arr)
{
arr[1] = 6;
}
void main()
{
int[3] a = [1, 2, 3];
writeln("a = ", a);
change(a);
writeln("a =
On Sat, 22 Nov 2014 18:20:44 +0400
drug via Digitalmars-d-learn wrote:
> I tried to pass pointer to static array but it didn't work.
i tried it right now and it works.
if you really want to get some help, you'd better give us something to
start with. i.e. your code, minified. D is great, but it
I tried to pass pointer to static array but it didn't work.
On Saturday, 22 November 2014 at 09:57:55 UTC, anonymous wrote:
On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
I know I can make a class immutable, but the problem is I want
to constrain a template parameter to only immutable types,
and I want to use class types.
template Foo(T : i
On Monday, 17 November 2014 at 21:12:54 UTC, Steven Schveighoffer
wrote:
On 11/14/14 6:29 PM, Satoshi wrote:
Hi, Im using GDC 4.9.0 compiler. I have template classes like
"public
class LinkedList(T) {...}" and when I try compile it together,
everything works fine. But when I compile every sourc
On Saturday, 22 November 2014 at 02:37:21 UTC, Eric wrote:
I know I can make a class immutable, but the problem is I want
to constrain a template parameter to only immutable types,
and I want to use class types.
template Foo(T : immutable Object)
Accepts immutable(Object) and other immutable c
36 matches
Mail list logo