object c ÄÚ´æ¹ÜÀí
¿´ÁËϹٷ½ÎĵµµÄ¹ØÓÚobject c µÄÄÚ´æ¹ÜÀí,×ܽáÏÂ:
ÔÚiphoneÖÐobject c ÖеÄÄÚ´æ¹ÜÀíÊÇͨ¹ý¼ÆÊýÆ÷À´¹ÜÀíµÄ,ÿ¸ö¶ÔÏóÄÚ²¿¶¼ÓÐÒ»¸ö¼ÆÊýÆ÷.н¨Ò»¸ö¶ÔÏó,»òÕßÕâ¸ö¶ÔÏó±»ÆäËû¶ÔÏóÒýÓÃ,¶à»áʹ¼ÆÊýÆ÷¼Ó1.Retain Ôö¼Ó¼ÆÊýÆ÷Öµ release ¼õÉÙ¼ÆÊýÆ÷Öµ.µ±¼ÆÊýÆ÷Ϊ0ʱ¶ÔÏó¾Ídealloc×Ô¼º.
ÔÚobject cÖÐÄãÉú³ÉµÄÒ»¸ö¶ÔÏóÄÇôÄã¾ÍÓÐÔðÈÎÈ¥ÊÍ·ÅËü£¬ÄÚ´æ¹ÜÀíµÄÒ»°ã¹æÔò£º
You own any object you create by allocating memory for it or copying it.
Related methods: alloc, allocWithZone:, copy, copyWithZone:, mutableCopy, mutableCopyWithZone:
If you are not the creator of an object, but want to ensure it stays in memory for you to use, you can express an ownership interest in it.
Related method: retain
If you own an object, either by creating it or expressing an ownership interest, you are responsible for releasing it when you no longer need it.
Related methods: release, autorelease
Conversely, if you are not the creator of an object and have not expressed an ownership interest, you must not release it.
¿¼ÂÇÏÂÃæÕâ¸öÀý×Ó£º
Thingamajig *thingamajig = [[Thingamajig alloc] init];
NSArray *sprockets = [thingamajig sprockets];
[thingamajig release];
thingamajig ÐèÒªrelease£¬ÒòΪºÜÏÔÈ»ÕâÀïÎÒÃÇÊÇthingamajig µÄowner¡££¨µÚÒ»Ìõ¹æÔò£©
ÄÇôsprockets Ϊʲô²»ÐèÒªreleaseÄØ¡£
Ê×ÏÈÎÒÃDz»ÊÇ sprockets µÄ creater.£¨µÚÒ»Ìõ¹æÔò£©,ÎÒÃÇҲûÓÐexpressing an ownership interest£¬ÒòΪÎÒÃÇûÓÐ
retainËü£¬£¨µÚ¶þÌõ¹æÔò£© ËùÒÔÎÒÃDz»¸ºÔðreleaseËü¡£
¾ßÌåÀ´¿´ thingamajig µÄ sprockets·½·¨µÄʵÏÖ£º
(NSArray *)sprockets {
NSArray *array;
array = [[NSArray alloc] initWithObjects:mainSprocket,auxiliarySprocket, nil];
return [array autorelease];
}
¿É¼û·ÖÅäµÄÄÚ´æÔÚ·
Ïà¹ØÎĵµ£º
- ҪʹÓöÏÑÔ¶Ôº¯Êý²ÎÊý½øÐÐÈ·ÈÏ
- ΪÁ˲»±ØÒªµÄ¿ªÏú£¬¿ÉÒÔ½öʹÓöÏÑÔ£¬¶ø²»Òªreturn
ÍøÉÏÓÐÈËдµÄstrcpy´úÂ룬×öÁËÌ«¶àµÄ³ö´í´¦Àí£¬µ¼ÖÂÐÔÄܵÍÏ£¬Æäʵû±ØÒª£¬ÓÃassert¾ÍÐÐÁË£¬ÕâÑùÔÚdebugģʽÏÂÄܲ¶×½´íÎó£¬releaseÏÂÓÖ²»Ó°ÏìÐÔÄÜ¡£
- ÊéÉÏÌṩµÄmemcpyµÄ·¶Àý
void memcpy(void* pvT ......
Visual C++6.0(5.0)¿ª·¢¹¤¾ß¹¦Äܷdz£Ç¿´ó£¬µ«ÊǶÔÓÚ³õѧÕßÀ´Ëµ£¬È´Óкܶàϸ½ÚµÄÎÊÌâÐèҪעÒâ¡£×÷ÕßËѼ¯ÕûÀíÁËÒÔÏÂһЩʵÓÃС¼¼ÇÉ£¬Ï£Íû¶Ô³õѧÕßÓÐËù°ïÖú¡£
1:ʹÓÃvc¿ª·¢ÏîĿʱ£¬³£»áÓöµ½ÕâÖÖÇé¿ö£º
¼´Ã÷Ã÷Ö»¸Ä¶¯ÁËÒ»¸öÎļþ£¬È´Òª°ÑÕû¸öÏîÄ¿È«²¿ÖØбàÒëÁ¬½ÓÒ»´Î¡£¸Õ¸ÕÁ¬½ÓºÃ£¬Ò»ÔËÐУ¬ÓÖÌáʾ ......
Author: Scurffybear Date: 2009.09.08
×î½üÔÚÕÐÐÂÈË£¬ÏÂÃæÊÇÒ»µÀCµÄÃæÊÔÌ⣬ÃæÊÔµÄÓ¡¶ÈÈËÖУ¬Ã»ÓÐÒ»¸öÈË×ö¶Ô£¬ÎÒ´Ö¿´ÁËÒ»ÏÂÌ⣬ÔÚûÓп´´ð°¸Ç°£¬ÎÒ×Ô¼ºÒ²×ö´íÁË£¬àÅ£¬Êǵģ¬Ã»É¶²»ºÃÒâ˼µÄ£¬ÎÒ¾õµÃÕâ¸öÌâÄ¿ºÜÈÝÒ×ʹÈ˲úÉúÎó½â£¬ÓÖ»òÕßÔñ£ÃÓÐÉîºñ¹¦µ×µÄÈËÄܶã¹ýÕâÒ»¸öÕÏÑÛ·¨£¿
ÒÔÏÂÊÇÌâÄ¿£¬
main()
{
char * ......
<script>
a=62;
function encode() {
var code = document.getElementById('code').value;
code = code.replace(/[\r\n]+/g, '');
code = code.replace(/'/g, "\\'
");
var tmp = code.match(/\b(\w+)\b/g);
tmp.sort();
var dict = [];
var i, t = '';
for(var i=0; i<tmp.length ......
int main()
{
printf(&unix["\021%six\012\0"], (unix)["have"] + "fun" - 0x60);
}
gcc -S±àÒë³É»ã±à´úÂëÈçÏÂ:
.file "test.c"
.section .rodata
.LC0:
&nbs ......