Show newer

POV: you are a nice crusty baguette on the kitchen counter and i want to make a sandwich at 1:47 a.m.

Show thread

re: Message from Mr Mittens 

@barquq @lapis what the fuck, i was gonna say this now what do i write

re: c++ complaining, wall of text 

@aescling again I return to the statement "reinterpret_cast<T&>(x) is the same thing as *reinterpret_cast<T*>(&x)"

A reinterpret cast to a reference type is equivalent to a dereferenced reinterpret cast of a pointer. It is very explicitly not a pointer.

re: c++ complaining, wall of text 

@aescling again I return to the statement "reinterpret_cast<T&>(x) is the same thing as *reinterpret_cast<T*>(&x)"

A reinterpret cast to a reference type is equivalent to a deferenced reinterpret cast of a pointer. It is very explicitly not a pointer.

re: c++ complaining, wall of text 

@aescling you are right, you can only reinterpret cast to a char pointer or reference. i was mistaken about the existence of reinterpret casts to char

I don't understand how the result is a char pointer. It is not. It is a char reference. References are aliases. They are like macros to the original thing. They aren't a number representing a location in memory. They are another name for the variable itself

re: c++ complaining, wall of text 

@aescling according to this stackexchange answer stackoverflow.com/a/5924278/22

"reinterpret_cast<T&>(x) is the same thing as *reinterpret_cast<T*>(&x)"

re: c++ complaining, wall of text 

@aescling reinterpret_cast tries not to make a copy of anything. it is looking at the same region of memory but interpreting it differently. that's what it does, that's the whole point

re: c++ complaining, wall of text 

@aescling you are making the rookie mistake of assuming that C++ makes sense

re: c++ complaining, wall of text 

@aescling why not

re: c++ complaining, wall of text 

@aescling reinterpret_casting to char or to char& is the exact same thing except whether or not the result is treated as an lvalue or rvalue.

re: c++ complaining, wall of text 

@aescling the image i drew is what would happen if you casted to char.

re: c++ complaining, wall of text 

in case you didn't know, C++ actually compiles to a set of machine instructions represented as speech bubbles from a cartoon laptop

“So who’s the head of your polycule?”

Our cat

re: c++ complaining, wall of text 

@aescling A reference is treated as an alias to some other preexisting value. A char reference is not a pointer. It is an alias for some preexisting char.

re: c++ complaining, wall of text 

@aescling Yes, the minimum size of of a char is 1 byte. I am fully aware of that.

There is no type in C++ that can be smaller than 1 byte. In fact, every type is some stored as a integral number of bytes. So any type can be reinterpreted as a char string. I don't see what the misconception is here.

re: c++ complaining, wall of text 

@Satsuma Anyway, I learn C++ so that I can hate the language better

re: c++ complaining, wall of text 

@Satsuma i wish i knew more about CSS

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.