|
i remember being pretty wowed when short strings became tagged pointers in objc. the implementation is clever & cool https://mikeash.com/pyblog/friday-qa-2015-07-31-tagged-pointer-strings.html
|
# ? Jul 21, 2017 19:59 |
|
|
# ? Jun 5, 2024 00:47 |
|
that article is out of date in one way, the tag bit has switched from the least-significant bit to the most-significant bit. exercise for readers (who know objc) to guess why
|
# ? Jul 21, 2017 20:23 |
|
rjmccall posted:that article is out of date in one way, the tag bit has switched from the least-significant bit to the most-significant bit. exercise for readers (who know objc) to guess why
|
# ? Jul 21, 2017 20:57 |
|
rjmccall posted:that article is out of date in one way, the tag bit has switched from the least-significant bit to the most-significant bit. exercise for readers (who know objc) to guess why total guess: "real" pointers rarely use the top bit e: wait is the reason objc specific?
|
# ? Jul 21, 2017 21:31 |
|
Powaqoatse posted:maybe garbage collection should collect itself :thinking_emoji:
|
# ? Jul 21, 2017 21:33 |
|
thunks r cool
|
# ? Jul 21, 2017 21:41 |
|
Powaqoatse posted:e: wait is the reason objc specific? yes
|
# ? Jul 21, 2017 22:00 |
|
rjmccall posted:yes thx im too buzzed to figure it out now & tomorrow is weekend so im not gonna think about computers. cya monday lol
|
# ? Jul 21, 2017 22:16 |
ieee spectrum 2017
|
|
# ? Jul 21, 2017 22:20 |
|
cinci zoo sniper posted:ieee spectrum 2017 languages on the autism spectrum
|
# ? Jul 21, 2017 22:23 |
|
I hope I never get old
|
# ? Jul 21, 2017 22:26 |
|
this guy owns
|
# ? Jul 21, 2017 22:28 |
|
cinci zoo sniper posted:ieee spectrum 2017 whats c++ rated so highly for?
|
# ? Jul 21, 2017 23:53 |
|
Fergus Mac Roich posted:whats c++ rated so highly for?
|
# ? Jul 22, 2017 06:14 |
|
it was an early language that went beyond the procedural C paradigm & caught on. there were loads of contenders & still are but nerds gonna nerd
|
# ? Jul 22, 2017 06:39 |
|
the whole windows application base was built with it, no big deal
|
# ? Jul 22, 2017 09:02 |
Fergus Mac Roich posted:whats c++ rated so highly for? more or less everything
|
|
# ? Jul 22, 2017 09:24 |
|
rjmccall posted:usually languages don't give you a way to explicitly request a specific nan, so every other nan bit pattern is available for stupid encoding tricks. thanks for writing all that. some random thoughts: practically speaking, there has to be a function to deserialize 4, 8 or more random bytes to a floating point number and back to bytes again to get values from memory into registers and back to memory again. you would hope that the roundtrip would be lossless and preserve all bit patterns, absent any arithmetic in between historically, nan patterns were envisioned as a way for conveying some information about the cause of the nan back to the programmer. starting with a 0x78000001 nan and incrementing it when an arithmetic operation returns it would tell you how many calculations earlier the nan result originated. this should be doable in hardware but alas in addition to nan encoding, maybe you could use denormals and set the processor to flush-to-zero mode to get a "zero encoding". then you would have double*pointer==0.0 and pointer+0.5==0.5 and pointer+boolean==0.0 and so on... anyone fancy some PHP on bare metal?!
|
# ? Jul 22, 2017 10:17 |
|
Max Facetime posted:historically, nan patterns were envisioned as a way for conveying some information about the cause of the nan back to the programmer. starting with a 0x78000001 nan and incrementing it when an arithmetic operation returns it would tell you how many calculations earlier the nan result originated. this should be doable in hardware but alas This would be super fun when you have one or more of * vectorisation * OOO execution * superscalar execution NaN payloads were a good effort, but no way would I ever rely on it.
|
# ? Jul 22, 2017 11:30 |
|
rjmccall posted:that article is out of date in one way, the tag bit has switched from the least-significant bit to the most-significant bit. exercise for readers (who know objc) to guess why I know objective c but I can't think of a reason the least significant bit of a pointer might be significant. a little hint?
|
# ? Jul 22, 2017 13:14 |
|
I thought this was pretty yospos: https://medium.com/@robertgrosse/rust-is-self-driving-c-9171c54c79f5quote:Rust is often mocked for the relentless evangelism of Rust programmers and its perceived overhyping. For people who aren’t already familiar with Rust, it is hard to understand what the big deal about it is, and hence all the talk about Rust just seems like a crazy fad. I think the best way to explain it is by analogy to the work on driverless cars.
|
# ? Jul 22, 2017 13:43 |
|
hackbunny posted:I thought this was pretty yospos: https://medium.com/@robertgrosse/rust-is-self-driving-c-9171c54c79f5 Its p on point
|
# ? Jul 22, 2017 14:28 |
|
hackbunny posted:I know objective c but I can't think of a reason the least significant bit of a pointer might be significant. a little hint? what is the most important operation in objective c, and what are its special cases?
|
# ? Jul 22, 2017 15:01 |
|
rjmccall posted:what is the most important operation in objective c, and what are its special cases? guessing it’s retain/release, because the tagged pointer check is somehow faster if it’s the msb? turns it into a negative signed integer? snarky commentary on guess: objc only seems to get new things for Swift bridging these days, was that the motivation for change? objc_msgSend is my other guess but idk if that counts as an operation and I can’t think of any special cases helped by changing the bit
|
# ? Jul 22, 2017 15:35 |
|
retain/release is not what i was thinking of, but it is also optimized by it, yes also your snark is conspicuously untrue
|
# ? Jul 22, 2017 15:53 |
|
C++ is a language born out of the Reagan era, no wonder it's such poo poo.
|
# ? Jul 22, 2017 16:07 |
|
Oh poo poo, I was also born out of the Reagan era
|
# ? Jul 22, 2017 16:08 |
|
rjmccall posted:what is the most important operation in objective c, and what are its special cases? i'm guessing something to do with message passing but hell if i know what
|
# ? Jul 22, 2017 16:09 |
|
how do you think message send works, and what are the special cases hint: there are two of them, and we’ve already mentioned one
|
# ? Jul 22, 2017 16:17 |
|
rjmccall posted:how do you think message send works, and what are the special cases don't care
|
# ? Jul 22, 2017 16:27 |
|
The driverless car analogy is nonsensical but it can't be denied that this:quote:At this point, some C++ programmers will object that if you are just smart enough, you won’t write bugs. is a completely useless, disingenuous tautology.
|
# ? Jul 22, 2017 16:29 |
|
I've never met a c++ programmer who likes c++.
|
# ? Jul 22, 2017 16:31 |
|
rjmccall posted:how do you think message send works, and what are the special cases oh well if it was done for message send then yeah I wouldn’t think it’s motivated by Swift bridging special cases I can think of are: tagged pointers nil forwarding I suspect you’re thinking of tagged pointers and nil, but I can’t figure out why that’s helped by changing the bit tho. it makes the special cases less than or equal to zero?
|
# ? Jul 22, 2017 16:48 |
|
pokeyman posted:oh well if it was done for message send then yeah I wouldn’t think it’s motivated by Swift bridging drat, you beat me; i just found this article https://www.mikeash.com/pyblog/friday-qa-2017-06-30-dissecting-objc_msgsend-on-arm64.html wherein the first two instructions of objc_msgSend are code:
|
# ? Jul 22, 2017 16:57 |
|
I’m sure I read that post at some point so i didn’t work that out all by myself
|
# ? Jul 22, 2017 17:16 |
|
rjmccall posted:how do you think message send works, and what are the special cases honestly I don't have the faintest idea of where you're going. I know about nil, I just learned about short NSStrings, I knew about some cases of NSNumber, but hell if I know what significance msb vs lsb could have
|
# ? Jul 22, 2017 19:35 |
|
code:
|
# ? Jul 22, 2017 19:38 |
|
akadajet posted:I've never met a c++ programmer who likes c++. Hello, nice to meet you Don't get me wrong, I'd love to take a chainsaw to the standard and clean the language up, but I still generally enjoy it.
|
# ? Jul 22, 2017 19:42 |
akadajet posted:I've never met a c++ programmer who likes c++. I actually like C++ and wrote most of the code for my thesis in it. It's not necessarily a "good" language, but I find it enjoyable to program in. I think a key point of my enjoyment of it is that no one else is working on my code though so I have perfect control over what parts of C++ I include in it, and if me-six-months-ago abused some C++ feature I can go back and rip it out without worrying about whether it's a breaking change or whatever. Also for whatever reason I really like working with weird-rear end template stuff, but I try to restrain myself with my thesis code since that can lead to insanity pretty quick. I've never used another language with generics as powerful as C++'s, which I think is a big part of the appeal. One of these days I'll have to check out Idris.
|
|
# ? Jul 22, 2017 20:12 |
|
|
# ? Jun 5, 2024 00:47 |
|
so, three thoughts about that rust thing - it’s mostly spot on, the state of systems programming really sucks and better languages can help a lot. none of the rest of this is a diss on the value of rust - a lot of how new languages improve that is just api design. like you protect against buffer overflow by just always passing around pointer/length pairs. this level of stuff could be done in any language and the only benefit of a new one is that people are writing new code by definition and you can pressure people into using your good new apis instead of the lovely ancient ones - that 95% figure sounds like bullshit to me. a lot of security bugs do not subvert the language model at all; they’re just logic errors in a part of the program that happens to have security implications. the idea that implementing stuff means you can fire your security teams and stop running bug bounties is ridiculous
|
# ? Jul 22, 2017 21:20 |