ホーム » 2012 » 9月 » 17

日別アーカイブ: 2012/09/17

2012年9月
 1
2345678
9101112131415
16171819202122
23242526272829
30  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,353 アクセス



Cocoa Programming for Mac OS X 3 – 3

156 ページのコードを入力してビルドすると,
 int row = [a indexOfObjectIdenticalTo:p] ;
 /…/〜.m:145:12: Implicit conversion loses integer precision: ‘NSUInteger’ (aka ‘unsigned long’) to ‘int’
 最近は,C++ ばかりだったので int() でくくるとエラー.
 int row = int([a indexOfObjectIdenticalTo:p]) ;
 C の (int) とすれば OK.
 int row = (int)[a indexOfObjectIdenticalTo:p] ;


indexOfObjectIdenticalTo を右クリックして「Jump to Definition」
 - (NSUInteger)indexOfObjectIdenticalTo:(id)anObject;
さらに NSUInteger に飛ぶと,
 #if __LP64__ || (…) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
  typedef long NSInteger;
  typedef unsigned long NSUInteger;
 #else
  typedef int NSInteger;
  typedef unsigned int NSUInteger;
 #endif


ソースの拡張子を m から mm に変更することによって,int ( … ) も可能となるみたい.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.