Monday, 24 September 2012


i have not tried this, not style, happens if declare ivar
code:
float cubematerialdiffusion[4];
does allocated space array within object? if so, if expect use array not vary in size, can provide pointer using address operator '&' (it seems poor style me, me).
 

is same cubematerialdiffusion array used instances of class? if so, use static c array, defined outside @interface. put in @implementation file, , declare static array:
code:
static float cubematerialdiffusion[] = {0.3, 0.7, 0.3, 1.0}; 
if don't know why i'm using static, should in c reference.

might want const qualifier on there, too, assuming array read-only.


if need different cubematerialdiffusion array each instance, it's sydde showed:
code:
@interface yourclassname : yoursuperclass {   float cubematerialdiffusion[4]; ..etc.. @end 
you don't use concise initializer notation, in init method:
code:
cubematerialdiffusion[0] = 0.3; cubematerialdiffusion[1] = 0.7; cubematerialdiffusion[2] = 0.3; cubematerialdiffusion[3] = 1.0; 
this same every other use of instance variable. don't concise initializers any of them. +alloc method guarantees ivars zeroed. other initialization responsibility.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment