मैं नमूना कोड ListAdder के माध्यम से पढ़ रहा था, और कई देखते हैं सही चर के बाद इस बात पर ज़ोर, या लगभग हर विधि में इस्तेमाल किया, उदाहरण के लिए:एक परियोजना में 'assert' का उपयोग क्यों कर रहे हैं? (और क्यों यह तो कई बार उपयोग करते हुए)
self.formatter = [[[NSNumberFormatter alloc] init] autorelease]; assert(self.formatter != nil);
या :
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
#pragma unused(tv)
#pragma unused(indexPath)
UITableViewCell * cell;
assert(tv == self.tableView);
assert(indexPath != NULL);
assert(indexPath.section < kListAdderSectionIndexCount);
assert(indexPath.row < ((indexPath.section == kListAdderSectionIndexNumbers) ? [self.numbers count] : 1));
मैं सोच रहा था, ऐसा करने का क्या मतलब है?
धन्यवाद
मुझे उद्देश्य सी के बारे में पता नहीं है लेकिन दूसरी भाषा में एस को संकलित समय पर अक्षम किया जा सकता है ताकि वे लाइव सिस्टम को धीमा न करें, लेकिन आप परीक्षण और स्टेजिंग के दौरान उन्हें बग डिटेक्शन के लिए उपयोग कर सकते हैं। – corsiKa