Skip to main content
1 vote
1 answer
54 views

In the documentation for the array_copy function in Guile Scheme is a warning that in the copy, "the array increments may not be the same as those of src". (Where "src" is the ...
neniu's user avatar
  • 431
0 votes
0 answers
93 views

I'm looking at the newly-introduced std::mdspan class template (also described here on SO). One of the template parameters is, according to cppreference: LayoutPolicy - specifies how to convert ...
einpoklum's user avatar
  • 137k
15 votes
1 answer
916 views

I recently found out about [[no_unique_address]] attribute in C++. According to cppreference.com: Applies to the name being declared in the declaration of a non-static data member that is not a bit-...
TheAliceBaskerville's user avatar
9 votes
1 answer
1k views

I'm trying to understand the difference between these three representations. So far I've figured out how #[repr(Rust)] and #[repr(C)] differ: #[repr(Rust)] is a default behavior while initializing, ...
Plz help's user avatar
  • 141
5 votes
4 answers
413 views

I have a set of structs that looks something like struct A { int x; int y; }; struct B { int x; int y; int z; }; struct Top { A a; B b; int* getPtr() { return &a.x; } }...
Cort Ammon's user avatar
  • 11.1k
4 votes
2 answers
82 views

Jim Butterfield's "Machine Language for Commodore Machines" book states at page 92 in the chapter on BASIC Memory Layout that (emphasis mine): End-of-BASIC is signaled by three zero bytes ...
Mr.C64's user avatar
  • 43.3k
1 vote
1 answer
223 views

If I have this struct: struct Tuple { unsigned int a : 4; unsigned int b : 4; }; I expected it to have a size of one bytes with both values being packed together, but on any compiler I have ...
julaine's user avatar
  • 2,313
2 votes
1 answer
92 views

Motivation I'm trying to establish an automatic sanity test algorithm which would raise a warning (via Swift Testing) when an arbitrary Type's MemoryLayout is potentially — it depends on the situation ...
user1040049's user avatar
1 vote
1 answer
503 views

Running this code below, the sizeof base class and derived class are both 32. #include "iostream" #include "string" using namespace std; class base{ //public: int ...
PkDrew's user avatar
  • 2,301
1 vote
1 answer
89 views

I understand stack moves from Higher memory address to Lower memory address,To find the size of the structure without using any library calls i used below logic, #include <stdio.h> typedef ...
Gokulanandan S's user avatar
1 vote
0 answers
101 views

When working in a raw/freestanding environment, I have a question about the .bss section in ELF files. If I link and set the output format to binary (not ELF), where will the .bss section be in the ...
Viliam Holly's user avatar
2 votes
1 answer
305 views

I was surprised that Option<Vec<T>> has the same size as Vec<T>: fn main() { println!( "u128: {} -> {}", size_of::<u128>(), size_of::<Option<...
mwlon's user avatar
  • 1,096
3 votes
2 answers
309 views

I've had a hard time removing usages of Unsafe and replacing with either VarHandle or MemorySegment/MemoryLayout. The goal is to remove usages of Unsafe and replace with nondeprecated API's. Two ...
Jonathan Garcia's user avatar
3 votes
1 answer
109 views

I ran into the following issue today: use std::mem::{size_of, MaybeUninit}; struct Foo<'a> { foo: &'a i32, } fn main() { println!("{}", size_of::<Option<Foo>>()...
ChrisB's user avatar
  • 4,156
1 vote
2 answers
287 views

I am using OpenCV to draw a rectangle on a binary image. My goal is to draw the rectangle on both the original image and its vertically flipped version. However, I encounter an issue when flipping the ...
meysam's user avatar
  • 194

15 30 50 per page
1
2 3 4 5
20