Skip to main content
3 votes
1 answer
174 views

In C++, what is the shortest way to declare a vector of vectors, where each inner std::vector's metadata fields (importantly size and pointer) have a user-chosen alignment? Ideally I'd be able to ...
nh2's user avatar
  • 26k
18 votes
0 answers
117 views

In the critpath of a threaded app I've encountered a performance bottleneck. profiling indicates unexpected contention on cache lines despite what appears to be independent data access across ...
Samonir's user avatar
  • 401
2 votes
1 answer
108 views

Prior to Clang 19, it was possible to write: struct alignas(8) my_struct { void* a_pointer; int a_variable; int _padding; }; However, in Clang 19, you must write: struct my_struct { ...
user18490's user avatar
  • 3,904
0 votes
1 answer
163 views

I'd like to understand the validity of different alignas specifier position within a plain array definition: constexpr std::size_t Required=16; alignas(Required) int iarr1[10]; // 1 int alignas(...
Oersted's user avatar
  • 3,834
1 vote
1 answer
134 views

I have a buffer with chunks that align to the cacheline size, but have arbitrary length, let's say 100 bytes. It is clear to me that the buffer (vector) elements are aligned on cacheline borders, but ...
glades's user avatar
  • 5,374
-1 votes
1 answer
6k views

I'm trying to assemble information in a struct to later memcopy it to an spi buffer. This is the code I'm working with: Demo #include <cstdio> #include <cstdint> #include <cstring> /*...
glades's user avatar
  • 5,374
6 votes
2 answers
705 views

The use of aligned_storage is deprecated in C++23 and suggested to be replaced with an aligned std::byte[] (see here). I have two questions about this: 1. How to align this? The document suggests to ...
TilmannZ's user avatar
  • 1,899
0 votes
1 answer
475 views

I'm using SSE/AVX and I need to store aligned data. how ever, my data can be of different types. so I use a union like this union Data { bool Bools[128]; int32 Ints32[128]; int64 Ints64[...
M.kazem Akhgary's user avatar
0 votes
0 answers
66 views

I was wondering if someone can try to implement alignas with mmap by playing with the first parameter? If not, then can anyone try to implement alignas themselves?
FariyaAchhab's user avatar
0 votes
2 answers
834 views

why alignas(64) not aligned with 64? for example: struct alignas(32) st32 { float a; uint16_t b; uint64_t c; }; struct alignas(64) st64 { float a; uint16_t b; uint64_t c; }; ...
daohu527's user avatar
  • 522
1 vote
1 answer
607 views

This must be a repeat question, but I have not found it after searching for 2 days ... I'm using MSVC with /std:c17 /std:c++17 and trying to get alignas(64) to work with arrays of doubles. The syntax ...
dts's user avatar
  • 223
3 votes
2 answers
1k views

This is the code I usually write: alignas(16) __m128 myBuffer[8]; But maybe (since the object-array is 128*8 bit = 128 byte) I should write: alignas(128) __m128 myBuffer[8]; Or, "since the ...
markzzz's user avatar
  • 48.3k
0 votes
1 answer
281 views

I am migrating a project from CubeIDE (GCC) to the most comprehensive software development solution for Arm®-based microcontrollers uVision (ARM Compiler 5) and have a difficulty using __align keyword....
Joej's user avatar
  • 1
2 votes
1 answer
686 views

Can C++ template parameters be used to control specifiers on the class itself to minimize some code duplication? For example: I have a class that I'd like to use both in a concurrent context (and ...
Kulluk007's user avatar
  • 1,002
1 vote
0 answers
109 views

Suppose I have the following simple class: struct employee{ std::string name; short salary; std::size_t age; employee(std::string name, short salary, std::size_t ...
alfC's user avatar
  • 16.8k

15 30 50 per page