```
int[string] aa = ["ok":1, "aaa":2, "ccc":3, "ddd":4];
foreach (k ; aa.byKey)
{
if (k == "aaa") {
aa.remove(k);
aa["ww"] = 33;
}
if (k == "ww") {
aa.remove(k);
aa["vv
is foreach Syntactic sugar?, like for-range in C++, if it is,
compiler how implement
struct Point {
int x;
int y;
this(int x, int y) { this.x =x; this.y=y;}
}
void addPoint(Point a, Point b) {
...
}
How too wirte this: addPoint({4,5}, {4,6})
Hi:
In C there has likely unlikely marco used by condition
expression。
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
if (likely(var > 1)) do...
How to do this in Dlang?
Hi:
Why need defined an abstract final class?
see
https://github.com/Rikarin/Trinix/blob/master/Kernel/arch/amd64/gdt.d
Hi:
With gcc we can use _ attribute _((section("name")) var; how
to same in dlang?
Hi:
I think the __traits(isSame, T, int) syntax is too uglily,
Is where an other way rewrite it. like this isSameType!(T,int)
On Thursday, 22 August 2019 at 17:01:09 UTC, Adam D. Ruppe wrote:
On Thursday, 22 August 2019 at 16:54:56 UTC, lili wrote:
I think the __traits(isSame, T, int) syntax is too uglily,
Is where an other way rewrite it. like this
isSameType!(T,int)
For types you can (and often should) just
Hi:
I write a template function is below, that need to remove
const topmost if has.
How to do this?
const int i =3;
println(i);
void println(A...)(A a)
{
char[20] numStr = void;
foreach(v ; a) {
if (is(v.type == byte) || is(v.type == ubyte) ||
Hi:
In C we can definition const int *ncp_to_cv;
or int * const cp_to_ncv;
How to do this in D.
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
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)
On Saturday, 24 August 2019 at 12:55:57 UTC, a11e99z wrote:
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.
Hi:
Masters who can write a book for Phbos, the dlang doc not
friendly to beginner.
On Wednesday, 28 August 2019 at 12:32:59 UTC, Andre Pany wrote:
On Wednesday, 28 August 2019 at 11:34:27 UTC, lili wrote:
Hi:
Masters who can write a book for Phbos, the dlang doc not
friendly to beginner.
There are 2 articles which I really like:
http://nomad.uk.net/articles/hidden-trea
Hi guys:
input is two line, first line is a number n and second line is
n float point number,
e.g. 3
1.1 2.2 3.3
how use stdin.readf get all number. i code below but not work
well.
int n;
stdin.readf!"%d\n"(n);
writeln("read n:",n);
foreac
On Tuesday, 3 September 2019 at 13:21:16 UTC, a11e99z wrote:
On Tuesday, 3 September 2019 at 12:55:29 UTC, lili wrote:
Hi guys:
input is two line, first line is a number n and second line
is n float point number,
e.g. 3
1.1 2.2 3.3
how use stdin.readf get all number.
htt
Hi:
For some reason it too slow that some times i visited
dlang.org, Can admin make a pdf document for download.
On Wednesday, 4 September 2019 at 04:21:10 UTC, Mike Parker wrote:
On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote:
Hi:
For some reason it too slow that some times i visited
dlang.org, Can admin make a pdf document for download.
Documentation is installed with the compiler.
Ho
On Wednesday, 4 September 2019 at 04:21:10 UTC, Mike Parker wrote:
On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote:
Hi:
For some reason it too slow that some times i visited
dlang.org, Can admin make a pdf document for download.
Documentation is installed with the compiler.
Th
Hi:
yesterday I saw some d code, where is an .fn() call syntax,
what is it mean.
Hi:
in phobos/std/range/primitives.d has this code
```
static assert( isInputRange!(int[]));
static assert( isInputRange!(char[]));
static assert(!isInputRange!(char[4]));
static assert( isInputRange!(inout(int)[]));
```
but the dynamic array and static array neither not has
p
Hi:
In C++20 Concepts is great idear. but I thinks it is too
difficult to write.
I like Rust traits simple and elegancy.
Hi:
In Dlang where is strange design. The in expression can only
use to associative array, why array can not use in expression.
On Thursday, 24 October 2019 at 22:40:31 UTC, Jonathan M Davis
wrote:
On Thursday, October 24, 2019 7:04:56 AM MDT Paul Backus via
Digitalmars-d- learn wrote:
On Thursday, 24 October 2019 at 12:58:11 UTC, lili wrote:
> Hi:
>In Dlang where is strange design. The in expression can
> only
>
>
Hi:
What is the alias Min = xxx mean? why need defined a alias Min in
Min template?
```
template Min(alias pred, Args...)
if (Args.length > 0 && __traits(isTemplate, pred))
{
static if (Args.length == 1)
{
alias Min = Alias!(Args[0]);
}
else static if (isLess!(pred, Args[
On Friday, 25 October 2019 at 21:06:53 UTC, IGotD- wrote:
On Friday, 25 October 2019 at 20:44:18 UTC, Dennis wrote:
On Friday, 25 October 2019 at 19:49:05 UTC, Ali Çehreli wrote:
I'm still not completely sold on the whole idea though
because it's not a clear win.
Do others see other advantage
Hi:
why writeln need GC?
Hi:
I want implementation Lua on D, I find that a PEG parser
https://github.com/PhilippeSigaud/Pegged
why do not use BNF parser. Is PEG better than BNF?
I want learn RISC-V and write a simple kernel on it using d. but
can not find any support about RISC-V.
On Sunday, 6 June 2021 at 04:53:08 UTC, Nicholas Wilson wrote:
On Sunday, 6 June 2021 at 04:14:20 UTC, lili wrote:
I want learn RISC-V and write a simple kernel on it using d.
but can not find any support about RISC-V.
LDC can compile for riscv 32 and 64 bit.
https://github.com/ldc-developers
I have used to ldc2(1.20.1) on x86-64 laptop with `ldc2 -c
-betterC -mtriple=riscv64 betterC.d -v ` but comiple is failed.
output:
```
binary/usr/bin/ldc2
version 1.20.1 (DMD v2.090.1, LLVM 10.0.0)
config/etc/ldc2.conf (riscv64)
'generic' is not a recognized processor for this targ
Hi gues:
I clone the dmd source code from github but i can find backend
code. there is a backend dir
in src but can not find x86 native code generator. and the dmd
wiki page just say
Back end
FileFunction
html.c Extracts D source code from .html files but source can't
find html.c file.
Hi guys:
Is the Dlang fix-length array alloc on stack? when a test
writeln([1]).sizeof //16
writeln([2]).sizeof //16
Why, What is the fix-length array memory layout.
On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote:
On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote:
Hi guys:
Is the Dlang fix-length array alloc on stack? when a test
writeln([1]).sizeof //16
writeln([2]).sizeof //16
Why, What is the fix-length array memory layout.
I'
Hi Guys:
see this code
~~~
int[] ar = [1,2,3,4,52,34,22];
auto h = heapify(ar);
assert(h.length() == ar.length);
writeln("h:",h);
assert(h.empty());
~~~
dmd v2.086.0 run all assert passed. Why?
On Tuesday, 18 June 2019 at 17:25:51 UTC, Johannes Loher wrote:
The result of heapify is a BinaryHeap, which is a range. writeln
basically prints ranges by iterating over them and printing
each element
(except for the types which are special cased, such as dynamic
arrays
etc.). However, ranges
On Tuesday, 18 June 2019 at 17:29:49 UTC, Cym13 wrote:
On Tuesday, 18 June 2019 at 17:25:42 UTC, Cym13 wrote:
On Tuesday, 18 June 2019 at 13:05:03 UTC, lili wrote:
On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote:
[...]
Thanks a lot, where is a core.stdcpp.array , How to user it?
I test
On Wednesday, 19 June 2019 at 12:53:05 UTC, Cym13 wrote:
Did you import it properly?
```
void main() {
import core.stdcpp.array;
auto a = array!(int, 4)();
}
```
compiles and runs without issue for me. You'll have to show
your code if you want people to help you there.
Hi Guys;
In the dmd source code, has lot of extern (C++), Why need this
and what is difference between extern(C++) extern(D), Thanks your
answer.
Hi Guys:
What is range.iota function full name
On Friday, 21 June 2019 at 09:09:33 UTC, aliak wrote:
On Friday, 21 June 2019 at 09:01:17 UTC, lili wrote:
Hi Guys:
What is range.iota function full name
That is the full name. Or what do you mean?
Found on the internet somewhere:
"The function is named after the integer function ⍳ from
A nick site, has a lot of languages, unfortunately no dlang in
there.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/
Hi Guys:
I look for the GC source code in /usr/include/dmd dir,
unfortunately not find.
44 matches
Mail list logo