Re: Merging two associative arrays

2019-08-24 Thread berni via Digitalmars-d-learn
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.

Re: Merging two associative arrays

2019-08-24 Thread a11e99z via Digitalmars-d-learn
On Saturday, 24 August 2019 at 19:35:25 UTC, berni wrote: 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] =

Merging two associative arrays

2019-08-24 Thread berni via Digitalmars-d-learn
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"]);

Re: [Help!] Use two different assembly symbol in D, but they are same address.

2019-08-24 Thread a11e99z via Digitalmars-d-learn
On Saturday, 24 August 2019 at 12:16:34 UTC, lili wrote: On Saturday, 24 August 2019 at 12:09:19 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 11:53:01 UTC, lili wrote: [...] resb 8 just reserving 8 bytes not initializing it. probably u compare some garbage. sometimes it equals,

Re: [Help!] Use two different assembly symbol in D, but they are same address.

2019-08-24 Thread lili via Digitalmars-d-learn
On Saturday, 24 August 2019 at 12:09:19 UTC, a11e99z wrote: On Saturday, 24 August 2019 at 11:53:01 UTC, lili wrote: [...] resb 8 just reserving 8 bytes not initializing it. probably u compare some garbage. sometimes it equals, sometimes not. no? I write wrong, not if (_vga_x == _vga_y)

Re: [Help!] Use two different assembly symbol in D, but they are same address.

2019-08-24 Thread a11e99z via Digitalmars-d-learn
On Saturday, 24 August 2019 at 11:53:01 UTC, lili wrote: Hi: definition _vga_x and _vga_y symbol in asm, compile use nasm -f elf64 -o boot.o boot.asm [section .bss] ... [global _vga_x] _vga_x: resb 8 [global _vga_y] _vga_y: resb 8 and nm boot.o show

[Help!] Use two different assembly symbol in D, but they are same address.

2019-08-24 Thread lili via Digitalmars-d-learn
Hi: definition _vga_x and _vga_y symbol in asm, compile use nasm -f elf64 -o boot.o boot.asm [section .bss] ... [global _vga_x] _vga_x: resb 8 [global _vga_y] _vga_y: resb 8 and nm boot.o show below ... 00107000 B _vga_x 00107008 B _vga_y and

Re: how to definition a non-const pointer that point a const var.

2019-08-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 24, 2019 12:48:33 AM MDT Max Haughton via Digitalmars-d- learn wrote: > On Saturday, 24 August 2019 at 05:03:43 UTC, Jonathan M Davis > > wrote: > > On Friday, August 23, 2019 10:14:56 PM MDT lili via > > > > Digitalmars-d-learn wrote: > >> Hi: > >>In C we can definition

Re: how to definition a non-const pointer that point a const var.

2019-08-24 Thread Max Haughton via Digitalmars-d-learn
On Saturday, 24 August 2019 at 05:03:43 UTC, Jonathan M Davis wrote: On Friday, August 23, 2019 10:14:56 PM MDT lili via Digitalmars-d-learn wrote: Hi: In C we can definition const int *ncp_to_cv; or int * const cp_to_ncv; How to do this in D. D uses parens to restrict how much of