« first day (3792 days earlier)      last day (1139 days later) » 

12:19 AM
 
 
2 hours later…
2:07 AM
I brought my pet chooks to the rural property, thought that they would enjoy good scenery and fresh food there. Instead, they are so scared, even back home today they tried to find every small gap and tried to hide inside those gaps.
They used to cluck for attention, but they are so quiet today.
 
 
10 hours later…
12:11 PM
It's cool how forgetting the l on a single endl leads to such an explosive error
 
nwp
Do you have to buy a new computer?
 
Depends if I can resist the urge youtube.com/watch?v=HtTUsOKjWyQ
 
nwp
The video is mislabeled, he just messed up the monitor and keyboard.
 
12:55 PM
@Mikhail I'm going to guess operator precedence is biting you
 
1:20 PM
@JerryCoffin TBF in kernel land they just explicitly used a struct albeit for security reasons IIRC
 
 
5 hours later…
6:31 PM
@Mgetz really I have no clue, but I'm still trying to debug this issue for like a day, which is probably the longest I've worked on a bug for a while.
xvalues were a mistake
 
@Mikhail try putting parens around the *object
that said why you are doing this... I don't know
as that seriously creates some not fun lifetime issues
 
writing object pools
But yes its not fun, this is some of the hardest (although not longest) code I've written. And I'm still not done.
 
why not just use an arena allocator?
 
I need something with std::shared_pointer semantics, but backed with a pool.
Honestly, I got strange and spooky constraints.
 
@Mikhail I think you need a colleague who's really good at C++. Too bad those are hard to find..
 
6:39 PM
They hired me for that :-/
 
@Mikhail so you need C#?
 
🌝
 
but seriously without knowing more about context... it's hard to advise, I generally avoid trying to move from a pointer allocated object
that's... usually a really really bad idea
 
I'm just starting to think I found a compiler bug but who knows...
 
unlikely?
which compiler?
 
6:42 PM
gcc 10.2
But yes, unlikely, although MSVC had bugs with default moves for a while
 
is it like reproducable, and I assume you have debug symbols for it?
 
Yeah, debug symbols are weird though. There is something with a signature that looks like a copy constructor but takes a pointer (rather than reference).
 
That's not a copy constructor.
That's a constructor taking a pointer.
 
Yeah, but I didn't write one. It might how copy-elision is represented...
 
6:46 PM
Something like that would never be generated by the compiler.
 
I doubt that copy elision generates code or symbols
 
Do you have a templated constructor?
 
Yeah
 
That's probably the one.
 
hmm I can't even get that to compile
as it's not a valid placement new syntax
 
6:52 PM
I mean the snippet you posted *object = reinterpret_cast<T *>(other.data) looks like you're assigning it a pointer
what the thing you're reinterpret casting? another pointer?
 
Here is a version of the data block for review: pastebin.com/uLVARWfF
 
Ok got it working godbolt.org/z/hrbE9T
 
alignment of data? Maybe, that's an issue.
 
not seeing copy constructors? godbolt.org/z/1rnhrn
I will never understand ICC sometimes... godbolt.org/z/1xocPd
 
@Mgetz at least the start of square is almost identical when you do -mtune=haswell
also interesting how icc throws in this "# Prob 32% " stuff
 
7:06 PM
I'm also worried that MSVC is so much shorter
 
// other object has been "moved from" and should be deleted, or it has been copied but we're dropping it, so also delete it
other_object->~T();
^ At least that looks wrong.
There's no need to invoke the destructor explicitly on moved-from objects.
 
what's wrong about it?
well there kind of is, if you're aliasing the memory
he doesn't store it as a T, so who else is going to call the destructor?
 
Hm, ok.
 
Also not aliasing because there is a check...
 
well I meant type punning or something like that
not as in aliasing one and the other
 
7:10 PM
Probably unrelated to your problem, but at line 3, the unsigned char data[sizeof(T)]; is probably wrong. (It should have a specified alignment.)
 
Hmm, why do you think that? Doesn't sizeof(T) include the padding in T, etc?
 
I mean it should have alignment of alignof(T).
Hm, good question.
The problem is that a char array has alignment of 1.
And your type T problably has an alignment of 8 or 16.
 
I don't even remember if reinterpret casting adjust alignment
 
I don't understand how alignment is relevant, the compiler must put an object of sizeof(T) at that memory location, whether it likes it or not?
 
Objects must be constructed at an address that matches their alignment.
 
7:14 PM
I see, so new() must be performed at a specified aligned memory address?
 
new returns an address that is maximally aligned
 
i'm doing a placement new
 
(Typically 16 bytes on modern CPUs.)
Yeah, but placement new must be performed on an address that is aligned at least to the alignment of the type.
I mean if T has alignment of 8. Then the address where T is constructed on must have an alignment of 8 or more.
 
Yeah.
 
7:17 PM
Yikes, that is certainly a potential problem.
 
Intel CPUs can deal with it.
 
I think it's more about what assumptions compilers make these days
 
I don't think it will crash your program, but you should fix it for correctness.
Also, even if it doesn't crash, misaligned data types can cause performance problems.
 
isn't even overalignment allowed these days? So some clown could make like a page-aligned type :P
 
overalignment is always allowed
 
7:22 PM
I mean like overaligned types. As in types that need alignment higher than the natural alignment
 
I don't even understand how you can ensure a structure be aligned. I understand that a structure can specify its member to be a certain byte offset that matches alignment but that structure can live inside another class that can be put into memory at any memory location...
 
no, not really, the alignment of the data member with the highest alignment affect the alignment of the surrounding type
 
@PeterT Nice save :)
 
So, you're saying its not defined to dump the object into a random memory location...
 
Yep.
It's OK to memcpy an int64_t into a char buffer. But if you want to retrieve the value from the buffer you need to memcpy the buffer over a int64_t variable (which has the proper alignment).
And then read the value from that int64_t variable.
You can't just reinterpret_cast the buffer to int64_t*.
@PeterT Yeah, I believe support was added for that. I haven't tried it yet, though.
I should figure that out though.
 
7:36 PM
@StackedCrooked I believe it's still required
 
@Mgetz Yeah, I changed my opinion after reading @PeterT's reply.
 
I probably should move this entire discussion...
 
I don't think we do that for discussions between regulars.
 
meh
 
Do what you want, I don't really care :)
At least you're being diligent :)
Also, Mikhail and PeterT might be eligible for ownership.
 
7:43 PM
Yeah I basically live here, also PeterT fixed some bug in microsoft's calculator (I think)
 
lol, that's not really an acomplishment.
Be impressed at people like Bruce Dawson
 
Was he the author of the bug ?
 
no, the dude finds so many windows bugs, just because he's maintaining chrome build infrastructure
 
7:55 PM
@JerryCoffin @Morwenn don't question my judgement!
 
did I ever question any room owner shenanigans?
 
8:53 PM
My last shenanigan was adding you as a room owner.
 
9:38 PM
So is the M1 chip actually faster or it just a meme from Apple's chronically underpowered users?
 
the answer is "faster than what"
 
Is it the fastest mobile chip?
 
no
it's gotta be waay up there in performance to battery life ration though
 
@StackedCrooked and I didn't question it :p
 
 
1 hour later…
10:52 PM
Is there any chance of recovering data from SD card if fdisk -l can't even see it?
 
11:10 PM
@northerner Try cleaning the contacts with alcohol? imgur.com/gallery/46Ufa/comment/227936203
Some SD cards also have a micro sd card inside which you might be able to get at.
 
11:47 PM
@JerryCoffin We never told anyone about long pointers of course.
Now we are closing in on 80decimal.
My students are very friendly. I love that.
 

« first day (3792 days earlier)      last day (1139 days later) »