Re: Is this a ctfe bugs ? ref scope const(ubyte)[32]

2023-09-06 Thread d007 via Digitalmars-d-learn
On Wednesday, 6 September 2023 at 12:15:02 UTC, Adam D Ruppe wrote: On Wednesday, 6 September 2023 at 12:04:40 UTC, d007 wrote: extern(C) int test(ref scope const(ubyte)[32] b); extern(C) int test(ref scope const(ubyte[32]) b); These are the same thing since the ref cannot be rebound anyway

Re: Is this a ctfe bugs ? ref scope const(ubyte)[32]

2023-09-06 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 6 September 2023 at 12:04:40 UTC, d007 wrote: extern(C) int test(ref scope const(ubyte)[32] b); extern(C) int test(ref scope const(ubyte[32]) b); These are the same thing since the ref cannot be rebound anyway; a static array just is its contents.

Is this a ctfe bugs ? ref scope const(ubyte)[32]

2023-09-06 Thread d007 via Digitalmars-d-learn
```d extern(C) int test(ref scope const(ubyte)[32] b); ``` This will automatic become this in ctfe relection ```d extern(C) int test(ref scope const(ubyte[32]) b); ``` LDC2 1.34.0 DMD v2.104.2

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Paul Backus via Digitalmars-d-learn
On Monday, 17 February 2020 at 20:08:24 UTC, Adnan wrote: On Monday, 17 February 2020 at 14:34:44 UTC, Simen Kjærås wrote: On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: // All in all, I end up with this code: module strassens_matmul package { T[][] mulIterative(T)(const T[][]

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
On Monday, 17 February 2020 at 14:34:44 UTC, Simen Kjærås wrote: On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: // All in all, I end up with this code: module strassens_matmul package { T[][] mulIterative(T)(const T[][] mat1, const T[][] mat2) { auto result = createMatr

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Simen Kjærås via Digitalmars-d-learn
rror: template instance strassens_matmul.getPointPtr!uint error instantiating source/strassens_matmul.d(48,29): I'd just finished writing a long post explaining the stuff you've apparently figured out. Ah well. :p In this case, getPointPtr return T*, but takes scope const ref

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
[][] mat, ulong row, ulong column, scope const T value) { mat[row][column] = value; }

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
On Monday, 17 February 2020 at 13:44:55 UTC, Adnan wrote: https://ideone.com/lVi5Uy module strassens_matmul; debug { static import std; } ... Okay I changed to module strassens_matmul; debug { static import std; } package { ulong getRowSize(T)(scope const T[][] mat

Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
long column) { return mat[row][column]; } T[][] mulIterative(T)(scope const T[][] mat1, scope const T[][] mat2) { auto result = createMatrix!T(mat1.getRowSize, mat2.getColumnSize); foreach (row; 0 .. mat1.getRowSize()) { foreach (column; 0 ..

Re: Scope const

2009-11-02 Thread Ali Cehreli
Jarrett Billingsley Wrote: > On Sat, Apr 11, 2009 at 5:33 AM, Kagamin wrote: > > If "in" is equivalent to "scope const". What "scope" means? Does it mean > > that this argument doesn't escape scope of this function? Then "const"

Re: Scope const

2009-04-11 Thread Jarrett Billingsley
On Sat, Apr 11, 2009 at 5:33 AM, Kagamin wrote: > If "in" is equivalent to "scope const". What "scope" means? Does it mean that > this argument doesn't escape scope of this function? Then "const" parameters > are not quite equivalent to &q

Scope const

2009-04-11 Thread Kagamin
If "in" is equivalent to "scope const". What "scope" means? Does it mean that this argument doesn't escape scope of this function? Then "const" parameters are not quite equivalent to "in" parameters.