« first day (1539 days earlier)      last day (1297 days later) » 

mr5
1:24 AM
what do you call to a data structure that sounded like m-ary tree but doesn't have a root node?
 
 
11 hours later…
12:32 PM
Sup everyone!
I am hacking a bit in XEN source code... when i compile it i get `address-of-packed-member` error...
Now I am compiling on x86 and it seems that this code is x86 only anyway:
```
CompactHashLogExtendEvent32((unsigned char *)
ADDR_FROM_SEG_OFF(ES,
regs->u.r16.di),
regs->u.r32.esi,
regs->u.r32.ebx,
regs->u.r32.ecx,
regs->u.r32.edx,
&regs->u.r32.edx); <----- Error passing pointer to a packed struct... (might be unaligned)
```
x86 can handle unaligned pointers should I just disable address-of-packed-member error for this code?
 
1 message moved from Lounge<C++>
@BananaBuisness it can in some cases but not all, it's not always as simple as "can handle unaligned." Particularly with function arguments which usually do have alignment requirements
 
static_cast<int&&>(3)++;
I don't see why this is an error saying "using rvalue as lvalue". Doesn't static_cast return rvalue reference here which is lvalue ?
 
@domocar1 operator++ doesn't operate on rvalues
 
what do you mean by "an rvalue reference which is lvalue"?
 
so it has to decay into an lvalue
either way that's some serious UB
 
12:44 PM
Isn't rvalue reference a lvalue ?
 
@domocar1 no it's an rvalue reference
 
Ihmm
 
1392
Q: What are rvalues, lvalues, xvalues, glvalues, and prvalues?

James McNellisIn C++03, an expression is either an rvalue or an lvalue. In C++11, an expression can be an: rvalue lvalue xvalue glvalue prvalue Two categories have become five categories. What are these new categories of expressions? How do these new categories relate to the existing rvalue and lva...

 
I got confused with something like this: int&& x = 3;
Isn't variable x here lvalue and rvalue reference at the same time ?
 
 
2 hours later…
3:15 PM
mp[key] = ls.insert(ls.begin(),{0,{key}});
how does this bit work {0, {key}} ? I have never seen this notation before
doesnt have the answer here
 
4:00 PM
@domocar1 The type of x is rvalue reference to int, the value category of x is lvalue.
@Permian That's just uniform initialization of a pair.
@domocar1 A named rvalue reference is an lvalue, but an anonymous rvalue reference is an xvalue (which is one kind of rvalue; the other one is prvalue).
 
4:31 PM
how was this thing working ?
I see there is no type check , parameters number check. How were the programmers dealing with this?
 
4:43 PM
@fredoverflow but why not do {0, key}?
why the extra brackets?
 
4:58 PM
@domocar1 When type deduction involves when declaring T&& x, the x is called Universal Reference that can be either rvalue or lvalue. Its exact value category will be determined at compile time.
Hi folks What are the differences between the following?


Case 1:

Person p{};


Case 2:

Person p = Person{};


Case 3:

Person&& p= Person{};
 
@Permian {0, key} would work for a pair<int, string>, but we have a pair<int, set<string>> here. The extra braces initialize a set with one string in it.
@NotAZoomedImage Just go with case 1, the other cases are more complicated and have no advantage over case 1.
 
@fredoverflow: OK. By the way, I just posted it to the main site.
0
Q: Are the following 3 ways to define objects identical?

Not A Zoomed ImageWhen defining variables or objects, I notice there are three ways as follows. What are the differences between the following? Case 1: Person p{}; Case 2: Person p = Person{}; Case 3: Person&& p= Person{};

 
5:31 PM
@NotAZoomedImage Yeah, I messed up the value category with actual types of expressions. But universal reference is something else, it occurs in template functions or in auto&& declarations.
 
My C++ is a bit rusty, could somebody enlighten me why this does not work:
http://coliru.stacked-crooked.com/a/cd5515199b24785
?
 
6:08 PM
Dammit. Seems like posts are getting lost for mysterious reasons.
@Nils sorry about that
Oh wait, it seems like the url is one character too short.
Maybe copy paste error.
 
 
1 hour later…
7:25 PM
yes, thanks @StackedCrooked
 
@Nils You need two braces in lines 7 and 10; the outer brace for the array struct, and the inner brace for the contained C array.
Also, you're probably better off with a struct Kernel3 { float data[3][3]; }; instead of a typedef.
@Nils Alternatively, remove all braces except one pair, that should also work.
39
Q: Why can't simple initialize (with braces) 2D std::array?

PiotrNycz Possible Duplicate: c++ why initializer_list behavior for std::vector and std::array are different I defined simple 2D array (3X2): std::array<std::array<int,3>,2> a { {1,2,3}, {4,5,6} }; I was surprised this initialization does not work, with gcc4.5 error: too many init...

 
7:56 PM
from the translation phases, can you say that for e.g the phase 1 is made by X , phase 2 by Y and so on ? (like by compiler/ by preprocessor)?
or can you somehow categorize them ? (phase 1-4 , 4-6 , 7 , 8)?
 
Thanks @fredoverflow
So you end up with std::array<std::array<int, 3>, 2> a2 { { { {1, 2, 3} }, { { 4, 5, 6} } } };
🤦 C++
But still I have to type then myKernel.data[x][y] every time, what I want of course is myKernel[x][y] I get there is a way to properly overload the [] operator. But I will leave it as it is now.
 
8:12 PM
@Nils std::array<std::array<int, 3>, 2> a2 {1, 2, 3, 4, 5, 6 }; should also work.
@Nils What's the point of const int n = N;?
 
I can check the size of a kernel if I forgot it :D But you are right it's not necessary.
@fredoverflow Thanks I read that but still awkward.
 

« first day (1539 days earlier)      last day (1297 days later) »