Two questions on the "For the curious section"


#1

First of congratulations to this great book, I’ve only made it to chapter 4 so far but it feels very well structured I explicitly love how you manage to introduce the xcode environment and its short cuts “on the fly” while the reader progresses.

I have two questions/additions to two paragraphs in the “For the More curious” section. The first one is about the following paragraph:

“In this chapter, we talked about the heap and how every object lives inside this part of memory. There are actually two more parts of memory that serve different purposes: the data segment and the stack. The data segment is where the application executable lives, and all of the instructions that make up your methods and functions live here. This area in memory never changes after an application is launched (…)”

I understand that you guys had to simplify things for this chapter but in order to make things a bit more correct wouldn’t a better statement be: “There are two more parts of memory that serve different purposes: the static segment and the stack. The static segment is divided into a code section, a read-only data section and a read-write data section. The code section contains all of the instructions that make up your methods and functions. The read-only data section contains all static read-only objects in your code and the read-write data section contains all static read-write objects in your code.”

I’m a newcomer to objective-C and iOS but I’m assuming that they didn’t change this part that is pretty identical for almost every OS much.

The second much smaller addition that popped into my head is for the paragraph on object sizes (p 75 “A pointer instance variable is simply four bytes” …). It would probably help the reader to point out that some sizes are dependent of the architecture of the underlying hardware (pointer, long, …).


#2

You are formally correct. I think this simplification was made because an “ideal” program does not use r/w static variables.


#3

About the 64-bit pointer size or long integer variables, IMHO there won’t be 64-bit iOS for a long time. Should there ever be one, a new edition should fix that :slight_smile: