On Thursday, 21 April 2022 at 05:49:12 UTC, Alain De Vos wrote:
Following program:
```
import std.stdio;
void main() @trusted
{
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
}
```
outputs :
7FFFD
On Thursday, 21 April 2022 at 05:49:12 UTC, Alain De Vos wrote:
Following program:
```
import std.stdio;
void main() @trusted
{
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
}
```
outputs :
7FFFD
On 21.04.22 07:49, Alain De Vos wrote:
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
`p` is no longer valid after `myfun` returns. Dereferencing it is an error.
The two `writeln` calls in `main` re-use the memor
Following program:
```
import std.stdio;
void main() @trusted
{
int *p=null;
void myfun(){
int x=2;
p=&x;
writeln(p);
writeln(x);
}
myfun();
*p=16;
writeln(p);
writeln(*p);
}
```
outputs :
7FFFDFAC
2
7FFFDFAC
32767
I don't understand why. Would it be pos
On Thursday, 21 April 2022 at 04:36:13 UTC, Salih Dincer wrote:
On Thursday, 21 April 2022 at 03:41:24 UTC, Ali Çehreli wrote:
On 4/20/22 19:11, Alain De Vos wrote:
> Maybe there are multiple solutions ?
Indeed. :)
I have a Range struct here:
http://ddili.org/ders/d.en/ranges.html#ix_rang
On Thursday, 21 April 2022 at 03:41:24 UTC, Ali Çehreli wrote:
On 4/20/22 19:11, Alain De Vos wrote:
> Maybe there are multiple solutions ?
Indeed. :)
I have a Range struct here:
http://ddili.org/ders/d.en/ranges.html#ix_ranges.infinite%20range
My favorite is the struct range. Because
On 4/20/22 9:53 PM, data pulverizer wrote:
On Thursday, 21 April 2022 at 00:14:16 UTC, Steven Schveighoffer wrote:
Did you substitute something real with `...` to hide it from your
post? Because that's not a real path.
I used it to hide my actual paths.
OK, so reviewing with that in mind,
On 4/20/22 19:11, Alain De Vos wrote:
> Maybe there are multiple solutions ?
Indeed. :)
I have a Range struct here:
http://ddili.org/ders/d.en/ranges.html#ix_ranges.infinite%20range
Another one with fibers here:
http://ddili.org/ders/d.en/fibers.html
The same chapter uses Generator:
h
Following java program creates an infinite fibonacci sequence
(stream) an takes the first 42 values of it.
import java.util.function.UnaryOperator;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class test3 {
public static void main(String[] args) {
int b
On Thursday, 21 April 2022 at 00:14:16 UTC, Steven Schveighoffer
wrote:
Did you substitute something real with `...` to hide it from
your post? Because that's not a real path.
I used it to hide my actual paths.
On 4/20/22 7:39 PM, data pulverizer wrote:
Hi all,
I'm trying to import a local dub package into a dub project (`json`
format). I have added the package I'm trying to import with `dub
add-local` and `dub add-path` and including it within the json file, but
I get the error
```
$ dub build
Pe
Hi all,
I'm trying to import a local dub package into a dub project
(`json` format). I have added the package I'm trying to import
with `dub add-local` and `dub add-path` and including it within
the json file, but I get the error
```
$ dub build
Performing "debug" build using /.../ldc2/bin/l
On Wednesday, 20 April 2022 at 18:04:13 UTC, Alain De Vos wrote:
When compiling a .d file i don't see line numbers on which the
error occurs which is quite annoying.
The line i use to compile is :
ldc2 --gcc=cc --vcolumns --oq --dip1000 --dip25
--safe-stack-layout --boundscheck=on --D --g --w -
When compiling a .d file i don't see line numbers on which the
error occurs which is quite annoying.
The line i use to compile is :
ldc2 --gcc=cc --vcolumns --oq --dip1000 --dip25
--safe-stack-layout --boundscheck=on --D --g --w --de --d-debug
`find . -name \*.d -print`
Even:
lcd2 test.d produ
On Wednesday, 20 April 2022 at 14:29:33 UTC, rikki cattermole
wrote:
On 21/04/2022 2:15 AM, rempas wrote:
Unfortunately, this will not work for me as it uses "TypeInfo"
and it is not available with "-betterC". Thank you for trying
to help regardless!
You can't use AA's in -betterC.
The impl
On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
```d
alias type = real;
alias func = type function(type a);
[...]
I think technically you should have save after range in that loop.
On 21/04/2022 2:15 AM, rempas wrote:
Unfortunately, this will not work for me as it uses "TypeInfo" and it is
not available with "-betterC". Thank you for trying to help regardless!
You can't use AA's in -betterC.
The implementation is not templated and is in druntime.
On Wednesday, 20 April 2022 at 11:10:18 UTC, vit wrote:
You need shared static this for initializing immutable AA:
```d
immutable void function(ref file_struct)[string]
common_identifiers;
shared static this(){
common_identifiers = [
"let" : &parse_let,
// "macro" :
On Wednesday, 20 April 2022 at 10:42:59 UTC, rempas wrote:
I'm trying to create an associative array where the keys will
be a "string" type and the values will be function pointers.
I'm using a custom type is called "file_struct" and for anyone
that wants to try specifically with this type, the
I'm trying to create an associative array where the keys will be
a "string" type and the values will be function pointers. I'm
using a custom type is called "file_struct" and for anyone that
wants to try specifically with this type, the definition is the
following:
```d
struct file_struct {
On Wednesday, 20 April 2022 at 08:37:09 UTC, Salih Dincer wrote:
On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
I get an unexpected result inside the second foreach() loop.
Anyone know your reason?
It's my fault, here is the solution:
```d
foreach(fun; funs)
{
ra
On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
I get an unexpected result inside the second foreach() loop.
Anyone know your reason?
It's my fault, here is the solution:
```d
foreach(fun; funs)
{
range.map!(a => fun(a))
.reduce!sum
.write
```d
alias type = real;
alias func = type function(type a);
void main()
{
import std.range;
auto range = 10.iota!type(14, .5);
alias fun1 = (type a) => a * a;
alias fun2 = (type a) => a * 2;
alias fun3 = (type a) => a + 1;
alias fun4 = (type a) => a - 1;
alias fun5 = (type a) => a
23 matches
Mail list logo