スキップしてメイン コンテンツに移動

投稿

2013の投稿を表示しています

3.4E-38

えっとね、10のべき乗の省略形なのさぁ。「○○○E△△△」 はねぇ 「○○○×(10の△△△乗)」 っていうことだよぉ。だから、「3.4E-38」 は 「3.4×(10の-38乗)」 ってことだよぉ。 桁が大きい数とか、小数点以下の桁が長い数とかで、ゼロ 「0」 をたくさん書くより短いく書けて、なおかつ間違えにくい数の書き方なんだよぉ。例えば、「3.4E-38」 を 普通に書くと 「0.000000000000000000000000000000000000034」 だけど、そんなふうに書くの嫌でしょぉ?なんだか何桁か分かんないから、書くとき間違えても気が付かなさそうだもんねぇ。 ちなみに、「E」 の語源は、「指数」 を意味する英語 「exponent」 の頭文字だよぉ。 で、3.4E-38~3.4E+38 っていうのは、絶対値での数の範囲のことだから、 .... 正の数なら 3.4×(10の-38乗) 以上 3.4×(10の+38乗) 以下の範囲、 .... 負の数なら -3.4×(10の+38乗) 以上 -3.4×(10の-38乗) 以下の範囲 で数値を表せるっていういみだょぉ。

3.4E-38

えっとね、10のべき乗の省略形なのさぁ。「○○○E△△△」 はねぇ 「○○○×(10の△△△乗)」 っていうことだよぉ。だから、「3.4E-38」 は 「3.4×(10の-38乗)」 ってことだよぉ。 桁が大きい数とか、小数点以下の桁が長い数とかで、ゼロ 「0」 をたくさん書くより短いく書けて、なおかつ間違えにくい数の書き方なんだよぉ。例えば、「3.4E-38」 を 普通に書くと 「0.000000000000000000000000000000000000034」 だけど、そんなふうに書くの嫌でしょぉ?なんだか何桁か分かんないから、書くとき間違えても気が付かなさそうだもんねぇ。 ちなみに、「E」 の語源は、「指数」 を意味する英語 「exponent」 の頭文字だよぉ。 で、3.4E-38~3.4E+38 っていうのは、絶対値での数の範囲のことだから、 .... 正の数なら 3.4×(10の-38乗) 以上 3.4×(10の+38乗) 以下の範囲、 .... 負の数なら -3.4×(10の+38乗) 以上 -3.4×(10の-38乗) 以下の範囲 で数値を表せるっていういみだょぉ。

primitive

design pattern

In order to answer the question of what a “thing” is, you have to first determine what its defining characteristics are. Other languages will refer to this as a “field”, a “member”, or even just a “variable”. However, in Objective-C the defining characteristics of an object are shown by its  properties . Describing the Object On to the second critical question for every object — what exactly does the object  do ? A programmatic description of what an object does is almost universally called a  method . Think about the common actions of the vehicles in the photos above:

property default assign

The article linked to by MrMage is no longer working. So, here is what I've learned in my (very) short time coding in Objective-C: nonatomic vs. atomic - "atomic" is the default. Always use "nonatomic". I don't know why, but the book I read said there is "rarely a reason" to use "atomic". (BTW: The book I read is the BNR "iOS Programming" book.) readwrite vs. readonly - "readwrite" is the default. When you @synthesize, both a getter and a setter will be created for you. If you use "readonly", no setter will be created. Use it for a value you don't want to ever change after the instantiation of the object. retain vs. copy vs. assign "assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes. "retain" is needed when the attribute ...

%hhd

%hd is used for  short integer  or  unsigned short integer %hhd is for  short short integer  or  unsigned short short integer %ld is for  long integer  or  unsigned long integer %lld is for  long long integer  or  unsigned long long integer Simple as that. Here  h  ,  hh  ,  l  ,  ll  are just length modifiers in %d

object-oriented design

In  Part 1 of this tutorial , you learned the basics of object-oriented design: objects, inheritance, and the model-view-controller pattern. You created the beginnings of a simple application called  Vehicles  to help you gain a better understanding of these concepts.

initWithStyle initWithCoder init

Everything traces back to  init . A  UITableViewCell  is a subclass of  NSObject , so it has an  init method. initWithFrame  is deprecated, and has been for some time (since iOS 3). You shouldn't be using it. It was replaced in iOS 3 with  initWithStyle , which you use to indicate what style of cell you'd like to create. initWithCoder  is another  NSObject  method, part of the  NSCoding  protocol. Again, you can see it in UITableViewCell  because it is a sub-class of  NSObject .  initWithCoder  is used to unarchive an object (perhaps you have saved an object directly to a file, for example).

typedef block

double (^g)( double , double ) = ^( double a, double b){             double c = a +b ;             return c;         }; ^( double a, double b) // the caret represents a block literal. This block takes two double parameters. Note we don't have to explicitly specify the return type {     double c = a + b;     return c; // }v typedef double (^BinaryOpBlock_t)( double , double ); BinaryOpBlock_t operation_creator( int op) {     if (op == 0)        return ^( double x, double y) { return x + y; }; // addition block     if (op == 1)        return ^( double x, double y) { return x * y; }; // multiplication block // ... etc. } int main() {     BinaryOpBlock_t sum = operation_creator(0); // option '0' represents add...