ios - Could [NSMutableArray array] return nil? -


for example in low memory conditions. i'm reading third party code , saw this

nsmutablearray *array = [nsmutablearray array];  if (array != nil) {      [array addobject:anobject]; } 

i've never check after creating array way nor alloc+init i'm in doubt.

technically, could return nil.

the probability of such failure @ point incredibly unlikely. app crash or abort before nil returned. consider unlikely malloc returning null.

my implementations have used checked object creation years - cannot remember ever seeing [nsmutablearray array] return nil in time in development/testing.

note answer specific [nsmutablearray array], not any/every initializer/constructor in existence. [nsmutablearray array] 'consistent' class of initializer/constructor in regard because there no reason fail under normal circumstances.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -