On 02/25/2016 04:47 AM, sigod wrote:
> void bar(ref int[] arr)
>
> Code wouldn't compile if you try to pass static array as `ref` argument.
To qualify further, static arrays cannot be passed as slice references
because although there is an automatic slicing of static arrays, such
slices a
On 2/24/16 9:08 PM, Adam D. Ruppe wrote:
On Thursday, 25 February 2016 at 01:31:17 UTC, Chris Wright wrote:
When you get to GC-allocated stuff, there's no way to tell.
The GC is easy, you can simply ask it:
http://dpldocs.info/experimental-docs/core.memory.GC.addrOf.1.html
"If p references m
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
Suppose we have a function like this:
void diss(int[] array) ...
How can we detect is `array` is static (fixed size) or dynamic,
inside the function body?
I don't see that anyone has mentioned it but:
https://dlang.org/phobos/std_
On Thu, 25 Feb 2016 02:08:18 +, Adam D. Ruppe wrote:
> On Thursday, 25 February 2016 at 01:31:17 UTC, Chris Wright wrote:
>> When you get to GC-allocated stuff, there's no way to tell.
>
> The GC is easy, you can simply ask it:
>
> http://dpldocs.info/experimental-docs/core.memory.GC.addrOf.
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
Suppose we have a function like this:
void diss(int[] array) ...
How can we detect is `array` is static (fixed size) or dynamic,
inside the function body?
I don't understand what I'm doing but got a proof of concept for
you. This
On Thursday, 25 February 2016 at 12:18:07 UTC, mahdi wrote:
On Thursday, 25 February 2016 at 11:50:02 UTC, sigod wrote:
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array
size to be able to accept a static array?
Can't
On Thursday, 25 February 2016 at 12:18:07 UTC, mahdi wrote:
On Thursday, 25 February 2016 at 11:50:02 UTC, sigod wrote:
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array
size to be able to accept a static array?
Can't
On Thursday, 25 February 2016 at 11:50:02 UTC, sigod wrote:
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array size
to be able to accept a static array?
Can't we just define a function which can accept any static
array
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array size
to be able to accept a static array?
Can't we just define a function which can accept any static
array with any size? (e.g. a function to calculate average of a
s
void diss(int n)(ref int[n] array) { }
But to consume array of any size, just take dynamic array as
parameter.
Thanks.
So when we define the function, we MUST specify the array size to
be able to accept a static array?
Can't we just define a function which can accept any static array
with any size? (e.g. a function to calculate average of a static
int array of any size)?
On 02/24/2016 08:44 PM, mahdi wrote:
> On Wednesday, 24 February 2016 at 22:38:04 UTC, Adam D. Ruppe wrote:
>> On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
>>> How can we detect is `array` is static (fixed size) or dynamic,
>>> inside the function body?
>>
>> `array` there is alway
On Wednesday, 24 February 2016 at 22:38:04 UTC, Adam D. Ruppe
wrote:
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
How can we detect is `array` is static (fixed size) or
dynamic, inside the function body?
`array` there is always dynamic because it is not of a fixed
size type.
On Thursday, 25 February 2016 at 01:31:17 UTC, Chris Wright wrote:
When you get to GC-allocated stuff, there's no way to tell.
The GC is easy, you can simply ask it:
http://dpldocs.info/experimental-docs/core.memory.GC.addrOf.1.html
"If p references memory not originally allocated by this gar
On Wed, 24 Feb 2016 21:48:14 +, mahdi wrote:
> Suppose we have a function like this:
>
> void diss(int[] array) ...
>
> How can we detect is `array` is static (fixed size) or dynamic,
> inside the function body?
Static arrays point to memory on the stack, inside an aggregate type on
the he
On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
How can we detect is `array` is static (fixed size) or dynamic,
inside the function body?
`array` there is always dynamic because it is not of a fixed size
type.
Why do you want to know though?
Suppose we have a function like this:
void diss(int[] array) ...
How can we detect is `array` is static (fixed size) or dynamic,
inside the function body?
17 matches
Mail list logo