object-layout Questions
1
Under what set of conditions is it safe to use std::memcpy to copy from one object to another?
For example, what conditions must T, src and dest satisfy for the following to be safe:
template <...
Crary asked 22/1, 2020 at 3:6
3
More specifically, assuming A is an accessible base class of B, does the following code produce undefined behavior, and is the assertion guarenteed not to fire according to the standard?
void test...
Affective asked 25/8, 2018 at 14:3
1
Solved
This is a big question, so I'm asking for a reference rather than a booklet-sized answer. I'm going through Stroustrup's Tour of C++, and it seems like the way objects are laid out is memory is fun...
Larissa asked 11/6, 2018 at 17:30
2
Solved
Intro:
I used the JOL (Java Object Layout) tool to analyze the internal and external fragmentation of Java objects for research purpose.
While doing so, I stumbled across the following:
x@pc:~/U...
Agglutinate asked 29/11, 2017 at 8:41
4
Solved
I found this in a website while reading about virtual inheritance in c++
When multiple inheritance is used, it is sometimes necessary to use virtual inheritance. A good example for this is the sta...
Hagar asked 3/3, 2011 at 11:2
3
Solved
I know that constant variables outside classes can be optimized directly into function calls by the compiler, but is it legal for the compiler to do the same for constant class variables?
If there...
Hijoung asked 31/7, 2017 at 14:5
4
Solved
In my first example I have two bitfields using int64_t. When I compile and get the size of the class I get 8.
class Test
{
int64_t first : 40;
int64_t second : 24;
};
int main()
{
std::cout &l...
Trainband asked 12/7, 2016 at 17:54
3
Solved
I've been asked in a recent interview about C++ struct fields alignment and theoretized that C and C++ follows the same strategy in struct packing.
Hovewer, it was the wrong assumption. The inter...
Glarus asked 20/11, 2015 at 20:31
3
Solved
Could you give me some information on what is exactly stored in object header? I know, that it's probably JVM dependent, but maybe for HotSpot at least? I'm looking for exact description specifical...
Eames asked 14/10, 2014 at 9:27
5
Solved
Can I treat consecutive data members of the same type as a range? For example:
struct X
{
int a, b, c, d, e;
};
X x = {42, 13, 97, 11, 31};
std::sort(&x.a, &x.a + 5); // kosher?
Ebsen asked 5/9, 2013 at 12:11
4
Solved
Where in memory is the vtable stored?
Lorrin asked 15/12, 2009 at 4:53
1
© 2022 - 2024 — McMap. All rights reserved.