On Sunday, 8 August 2021 at 02:00:26 UTC, Tejas wrote:
On Saturday, 7 August 2021 at 19:07:04 UTC, Paul Backus wrote:
On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote:
On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote:
[...]
Oh wow, and here I thought I was being smart :(
On Saturday, 7 August 2021 at 19:07:04 UTC, Paul Backus wrote:
On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote:
On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote:
[...]
Oh wow, and here I thought I was being smart :(
So, how can we work around this without assembly langua
On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote:
On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote:
The issue with `align` attributes being ignored for stack
variables is apparently a known bug, first reported in 2016:
https://issues.dlang.org/show_bug.cgi?id=16098
The i
On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote:
On Saturday, 7 August 2021 at 14:34:49 UTC, Tejas wrote:
[...]
For the array as a whole to be aligned, not only must the
spacing between the elements respect the alignment, but
starting address of the array itself must be a multi
On Saturday, 7 August 2021 at 14:34:49 UTC, Tejas wrote:
Umm, the ```align array``` solution is flat out wrong, please
ignore it. Most likely a bug in the compiler.
Also, why will the address of the first element of the array
```modulo``` alignment be 0? The address of the array has
absolu
On Saturday, 7 August 2021 at 13:36:52 UTC, james.p.leblanc wrote:
On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote:
[...]
**First, thanks all for helping with this question!**
The simple desire to arbitrarily align an array is certainly
looking non-trivial.
Below is a simple pr
On Saturday, 7 August 2021 at 13:36:52 UTC, james.p.leblanc wrote:
On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote:
[...]
**First, thanks all for helping with this question!**
The simple desire to arbitrarily align an array is certainly
looking non-trivial.
Below is a simple pr
On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote:
On Saturday, 7 August 2021 at 07:32:04 UTC, Tejas wrote:
And if it really is correct, then it seems once again that
static arrays are the answer after all:
```d
align(your_alignment) int[your_length] array;
```
No need for structs
On Saturday, 7 August 2021 at 07:32:04 UTC, Tejas wrote:
And if it really is correct, then it seems once again that
static arrays are the answer after all:
```d
align(your_alignment) int[your_length] array;
```
No need for structs \\('_')/
The main advantage of the struct is that you can heap
On Friday, 6 August 2021 at 22:15:00 UTC, Paul Backus wrote:
On Friday, 6 August 2021 at 19:03:53 UTC, Tejas wrote:
Stealing Paul's answer now:
```d
import std;
enum your_max_length = 1000;
enum your_align = 256;
struct MySlice(T/*, size_t maxLength*/)
{
private align(your_align)T payload;
On Friday, 6 August 2021 at 19:03:53 UTC, Tejas wrote:
Stealing Paul's answer now:
```d
import std;
enum your_max_length = 1000;
enum your_align = 256;
struct MySlice(T/*, size_t maxLength*/)
{
private align(your_align)T payload;
//invariant(payload.length <= maxLength);
//this(T[
On Friday, 6 August 2021 at 18:02:01 UTC, james.p.leblanc wrote:
mes
On Friday, 6 August 2021 at 17:25:24 UTC, Tejas wrote:
Okay we were overthinking the solution.
Just use a static array
```d
int[your_max_length]/*or whatever type*/ var;
```
You're good to go!
I almost feel stupid now lol
On Fri, Aug 06, 2021 at 06:02:01PM +, james.p.leblanc via
Digitalmars-d-learn wrote:
[...]
> However, do NOT feel stupid ... the motivation behind why
> I cannot use a standard int[your_max_length] (in other words,
> use a static array), is because I need to do a specified
> memory alignment (
mes
On Friday, 6 August 2021 at 17:25:24 UTC, Tejas wrote:
Okay we were overthinking the solution.
Just use a static array
```d
int[your_max_length]/*or whatever type*/ var;
```
You're good to go!
I almost feel stupid now lol
Hello Tejas,
Kind thanks for your replies ... all are appreciat
On Friday, 6 August 2021 at 10:50:19 UTC, james.p.leblanc wrote:
I am aware of the "capacity" concept with slices.
But, I would like to know if it is possible to set a
hard limit on a slice size.
I prefer it to error and crash instead of a doing an
extension or reallocation.
I understand my qu
On Friday, 6 August 2021 at 17:16:28 UTC, Tejas wrote:
On Friday, 6 August 2021 at 16:32:59 UTC, james.p.leblanc wrote:
On Friday, 6 August 2021 at 11:58:59 UTC, Paul Backus wrote:
[...]
```
Paul,
Thanks very much for your reply. I understand only
a fraction of the suggested solution. I wi
On Friday, 6 August 2021 at 16:32:59 UTC, james.p.leblanc wrote:
On Friday, 6 August 2021 at 11:58:59 UTC, Paul Backus wrote:
struct MySlice(T, size_t maxLength)
{
private T[] payload;
invariant(payload.length <= maxLength);
this(T[] slice) { payload = slice; }
T opIndex(size_t i
On Friday, 6 August 2021 at 11:58:59 UTC, Paul Backus wrote:
struct MySlice(T, size_t maxLength)
{
private T[] payload;
invariant(payload.length <= maxLength);
this(T[] slice) { payload = slice; }
T opIndex(size_t i) { return payload[i]; }
// etc.
}
```
Paul,
Thanks very mu
On Friday, 6 August 2021 at 10:50:19 UTC, james.p.leblanc wrote:
I am aware of the "capacity" concept with slices.
But, I would like to know if it is possible to set a
hard limit on a slice size.
I prefer it to error and crash instead of a doing an
extension or reallocation.
I don't think the
I am aware of the "capacity" concept with slices.
But, I would like to know if it is possible to set a
hard limit on a slice size.
I prefer it to error and crash instead of a doing an
extension or reallocation.
I understand my question screams of "convoluted
thinking". But, I need to align my
20 matches
Mail list logo