4 ms·
How Objective-C messaging works
- austinz 13y agoWhat is "0xreadbook" in the context of a 32-bit int supposed to mean? Is the author just trying to be cute, or is this some sort of nonstandard representation of hexadecimal digits that I need to read up on?
- orta 13y agoIt's the author being cute I think. I've never heard of it either.
- tdd1 13y agoYes dude, it just an example hexadecimal representation. Don't take everything so literally...
- aa0 13y agoLiterally? A tutorial for noobs should be literally accurate -- throwing around non-proper representations is just a cloudy lazy explanation.
- tdd1 13y agoappreciate, don't hate
- aa0 13y agoAppreciate misinformation? No thanks.
- to3m 13y agoIt's a reasonable comment. I got to "0xreadbook" and found it rather difficult to continue. If you're trying to explain stuff, you need to get these things right. You wouldn't provide something like "LET STORE OF VALUE X CONTAIN LITERALLY 15 AS INTEGER" as example C code, right? Because it's not even C. In fact it's just nonsense. So I fail to see why "0xreadbook" is a valid example hex value... because it's not even hex. Bizarrely, despite the author's apparent confusion about this basic concept, the rest of the piece seemed kind of OK, and he even got the hex representation of 1.f correct. A much better example hex number is 0x12345678. Every digit is different, and it's actually a valid number.
- deleted 13y ago[deleted]
- taspeotis 13y agoit just an example hexadecimal representation It's not hexadecimal, so what's your point?
- aa0 13y ago0xreadbook is not hexedecimal and disqualifies this whole post from any kind of intellectual redemption. Try 0xDEADBEEF,0xBAADF00D, or any constant listed here: http://en.wikipedia.org/wiki/Hexspeak http://en.wikipedia.org/wiki/Hexspeak
- tomjakubowski 13y agoI'd probably avoid 0xB16B00B5.
- aa0 13y agoI'd probably multiply and sum...
- pohl 13y agoThat's a bit overpedantic. It's a mnemonic for remembering the way the bytes are arranged in memory: "Ok, Bo: add re". Nobody complains that r, o, y, g, b, i, and v aren't actual colors, do they? Other than you, I mean. http://en.wikipedia.org/wiki/List_of_mnemonics http://en.wikipedia.org/wiki/List_of_mnemonics
- aa0 13y agor=red, o=orange, y=yellow, etc.. No problem there. What does K equal in hexadecimal? Well, it isn't defined for hexadecimal. K=20 is only defined in Base 21 and above. Other than me? Hah, nice cheap shot, pole ;-)
- pohl 13y agoThe letters need only illustrate the positions and be memorable. No hex is required for this purpose. Edit: The 0x communicates that the mnemonic is illustrating base 16, so your objection below is not valid.
- aa0 13y agoEndian-ness changes when the base changes. For a clear explanation, actual hex is needed.
- rsingla 13y agoWell at least the 16 year old tried?
- stevejohnson 13y agoTry these if you'd like an actual explanation of how Obj-C messaging works. http://www.mikeash.com/pyblog/friday-qa-2012-11-16-lets-build-objc_msgsend.html http://www.mikeash.com/pyblog/friday-qa-2012-11-16-lets-buil... http://www.friday.com/bbum/2009/12/18/objc_msgsend-part-1-the-road-map/ http://www.friday.com/bbum/2009/12/18/objc_msgsend-part-1-th...
- chromejs10 13y agoI agree. This post isn't the best explanation and is riddled with grammatical errors that caused me to reread sentences multiple times. Regardless of the age of the author, if you put up a blog post that is supposed to explain a concept to other people, it needs to be well thought out and proof read. Mike Ash is an excellent example of how to write blog posts about how things work
- dmishe 13y agoAlso, Mark Dalrymple series http://blog.bignerdranch.com/author/markd/ http://blog.bignerdranch.com/author/markd/