Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with meaning of dot in .size

 
Larry Frissell
Ranch Hand
Posts: 82
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading IOS 5 Developer's Cookbook by Erica Sadun. In the line of code below, I am trying to understand why there is a dot before "size". I know that "size" is a property of CGRect, and I understand how to use the "dot" for something like frame.width, but the syntax below appears to be different.

 
Larry Frissell
Ranch Hand
Posts: 82
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found my answer to the code snytax at cupsofcocoa
It is based on the C structs format shown below.
Initializing Structures
The fastest way to initialize a structure is to enclose the values in a pair of braces:

Date today = {5, 22, 2011};You can list fewer values, and they will be filled in until the end of the values you list. The remaining values will be undefined.
Date today = {5};This sets the month to 5, but leaves the remaining fields with garbage values from RAM.
You can also initialize the values out of order:
Date today = {.day = 22, .month = 5; .year = 2011};


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic