On Saturday, 17 December 2022 at 00:23:32 UTC, thebluepandabear
wrote:
I am reading the fantastic book about D by Ali Çehreli, and he
gives the following example when he talks about variadic
functions:
```D
int[] numbersForLaterUse;
void foo(int[] numbers...) {
numbersForLaterUse = numbers
On Sat, Dec 17, 2022 at 02:36:10AM +, thebluepandabear via
Digitalmars-d-learn wrote:
[...]
> Thanks, I've tried to mark it with `@safe` and it did give me a
> warning.
>
> I was also wondering, why is this code valid?
>
> ```D
> int[] numbersForLaterUse;
>
> @safe void foo(int[] numbers) {
On 12/16/22 18:20, H. S. Teoh wrote:
> scratch space for computations, called the runtime
> stack.
I called it "function call stack" where I gave a very simplistic view of
it here:
https://www.youtube.com/watch?v=NWIU5wn1F1I&t=236s
> (2) Use @safe when possible so that the compiler will te
T
Thanks, I've tried to mark it with `@safe` and it did give me a
warning.
I was also wondering, why is this code valid?
```D
int[] numbersForLaterUse;
@safe void foo(int[] numbers) {
numbersForLaterUse = numbers;
}
```
On Fri, Dec 16, 2022 at 05:39:08PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> If you really want to see what could possibly have gone wrong, try
> this version of the code:
[...]
> The results will likely differ depending on your OS and specific
> environment; but on my Linux machine
On Sat, Dec 17, 2022 at 12:23:32AM +, thebluepandabear via
Digitalmars-d-learn wrote:
[...]
> ```D
> int[] numbersForLaterUse;
>
> void foo(int[] numbers...) {
>numbersForLaterUse = numbers;
> }
>
> struct S {
> string[] namesForLaterUse;
>
> void foo(string[] names...) {
> nam
On Saturday, 17 December 2022 at 00:23:32 UTC, thebluepandabear
wrote:
```D
int[] numbersForLaterUse;
void foo(int[] numbers...) {
numbersForLaterUse = numbers;
}
struct S {
string[] namesForLaterUse;
void foo(string[] names...) {
namesForLaterUse = names;
}
}
```
[...]
The thin
I am reading the fantastic book about D by Ali Çehreli, and he
gives the following example when he talks about variadic
functions:
```D
int[] numbersForLaterUse;
void foo(int[] numbers...) {
numbersForLaterUse = numbers;
}
struct S {
string[] namesForLaterUse;
void foo(string[] names.