
velaadutunna pointer

computer prograaminglo velaadutunna pointerlu mariyu wild pointerlu anevi saraina rakam yokka chellubaatu ayye vastuvunu suuchimchani pointerlu. ivi ghnaapakasakti bhadrata ullanghanalaku sambandhinchina pratyeka kesulu. marinta saadhaaranamgaa, velaadutunna suuchanalu mariyu adavi suuchanalu chellubaatu ayye gamyasthaanaaniki parishkarinchani suuchanalu.
vastuvu naasanam samayamlo velaadutunna pointerlu talettutaayi, incoming reference unna vastuvu tolaginchabadinappudu ledhaa ketayinchabadinappudu, pointer viluvanu savarinchakundaa, tadwara pointer ippatikee ketaayinchina memory yokka memory sthaanaanni suuchistumdi. vyavastha gatamlo vidudala chesina memarini tirigi ketayinchavacchu, mariyu programme appudu (ippudu) velaadutunna pointernu soochinchakapothe, "anoohya pravartana phalitamgaa undavacchu", endukante memory ippudu puurtigaa bhinnamaina daetaanu kaligi undavacchu. programme velaadutunna pointer dwara suuchimchabadina memareeki vraasthe, sambandham laeni dayta yokka nissabda avineeti phalitamgaa undavacchu, idhi kanugonadam chaalaa kashtamgaa unde suukshma doshaalaku daariteestundi. memarini maroka prakriyaku tirigi ketayinchinatlayite, velaadutunna pointernu dererance cheyadaaniki prayatninchadam vibhajana lopaalu (unix, linux) ledhaa saadhaarana rakshana lopaalu (vindos) kaliginchavacchu. kernell yokka memory ketaayimpudaaru upayoginche book keeping daetaanu bharti cheyadaaniki prograamnu anumatinchadaaniki tagina adhikaralu unte, avineeti vyavastha asthiratalanu kaligistundi. chettha sekaranato kuudina vastuvu-aadhaarita bhaashalalo, velaadutunna suuchanalu cherukoleni vastuvulanu matrame naasanam cheyadam dwara nirodhinchabadataayi, antey vatiki incoming pointerlu laevu; idhi tracing ledhaa reference counting dwara nirdhaarinchabadutundi. ayithe, oka tudi roopakarta oka vastuvu gurinchi kotta suuchanalanu srushtinchavachu, velaadutunna suuchananu nivaarinchadaaniki vastuvu punarutthaanam avasaram.
konni prograaming bhaashalalo saadhyamayye konni telisina sthithiki praarambhinchadaaniki mundu pointernu upayoginchinappudu wild pointerlu talettutaayi. avi velaadutunna pointerla maadirigaane asthira pravartananu chuuputaayi, ayinappatikee avi gurtinchabadakunda unde avakaasam takkuvagaa untundi, endukante praarambhinchataaniki mundu prakatinchabadina chararaasulanu access chesthe aneka compilerlu compile samayamlo heccharikanu levanettutaayi.
velaadutunna pointerlaku kaaranam.
aneka bhaashalalo (udhaa.zii.sii prograaming longuage) memory nundi oka vastuvunu spashtamgaa tolaginchadam ledhaa tirigi vachinappudu stock framenu naasanam cheyadam dwara anubandha paayintarlanu maarchadu. pointer ippudu itara prayojanaala kosam upayoginchinappatiki, memarylo adhe sthaanaanni suuchistumdi.
oka suutigaa udaaharana krinda choopabadindihi
 chaar * dipi = shoonya;
 {
 chaar sii;
 dp = & c;
 / * sii paridhi nundi bayataku vastundi */
 / * dipi ippudu oka velaadutunna suuchika */
operating system shoonya pointerlaku runn-time suuchanalanu gurtinchagaligite, lopali block nishkraminchadaaniki ventane mundu 0 (shoonya) nii dp kii ketayinchadam paidaaniki parishkaram. maroe parishkaram emitante, marinta praarambhinchadam lekunda dipi mallee upayoginchabadadani edho okavidhamgaa haamii ivvadam.
velaadutunna pointerlaku maroka tarachugaa muulam coquire 1 mariyu coquire 2 library calls yokka gandaragola kalayikah adhi soochinche memory blacknu vidudala chesinappudu oka pointer velaadutundi. munupati udaaharana maadirigaane, dheenini nivaarinchadaaniki oka maargam emitante, pointernu daani suuchananu vidudala chesina tarvaata shoonyamgaa reset cheyadam-krinda pradarsinchina vidhamgaa.
shoonya funk ()
 chaar * dipi = mallok (a _ sthiraamkam);
 uchita (dp);/* dp ippudu velaadutunna pointer avutundi */
 dp = shoonya;/* dp ikapai velaadadeeyabadadu */
stock-ketaayinchina lokal variable yokka chirunaamaalanu tirigi ivvadam chaalaa saadhaarana tappuh okasari coll cheyabadina function tirigi vasthe, eee variables kosam sthalam ketayinchabadutundi mariyu saanketikamgaa avi "chettha viluvalanu" kaligi untaayi.
int * funk (shoonya)
 intnum = 1234;
 tirigi & num;
pointer nundi chadavadaaniki chese prayatnaalu coque _ 3kii coll chesina tarvaata kontakaalam saraina viluvanu (1234) tirigi ivvavacchu, conny aaa taruvaata coll cheyabadina yea vidhamaina functionlu ayina coque _ 4 kosam ketaayinchina stock nilvanu itara viluvalatho bharti cheyavachu mariyu pointer ikapai sarigga panicheyadu. coakways _ 4kii pointernu tirigi ivvalsi vasthe, coakways _ 4 functionku minchina paridhini kaligi undaali-dheenini coakways _ 7gaa prakatinchavacchu.
velaadutunna suuchana lekunda manueval deallocation.
 (1945-1996) oka puurti object management systemnu srushtinchindi, idhi velaadutunna reference drugvishayam lekunda untundi. idhe vidhamaina vidhananni matsyakaarulu mariyu leblock "taalaalu mariyu taalaalu" paerutoe pratipaadinchaaru.
adavi pointerlaku kaaranam.
modati upayogam mundu avasaramaina praarambheekarananu tolaginchadam dwara wild pointerlu srushtinchabadataayi. anduvalla, khachitamgaa cheppalante, praarambhinchadaanni amalu cheyani prograaming bhaashalalooni prati pointer wild pointerga praarambhamavutundi.
idhi chaalaa tarachugaa praarambheekaranapaiki dookadam valla sambhavistundi, daanini tolaginchadam dwara kaadu. chaalaa mandhi compilerlu dheeni gurinchi heccharinchagalugutaaru.
intu eff (intu ii)
 chaar * dipi;/* dipi anedi oka wild pointer */
 static chaar * esppi;/* esppi anedi adavi suuchika kaaduh
 * sthira chararaasulu 0kii praarambhinchabadataayi
 * praarambhamlo mariyu vaari viluvalanu nilupukondi
 * aaa tarvaata chivari coll.
 * eee lakshanaanni upayoginchadam cheddadigaa pariganinchavacchu
 * vyaakhyaaninchakapothe shaili */
velaadutunna paayintarlatho kuudina bhadrata randhraalu.
buffer-ovarflo doshaala maadirigaa, velaadutunna/adavi pointer doshaalu tarachugaa bhadrata randhraluga maarataayi. udaaharanaku, virtual function coll cheyadaaniki pointernu upayoginchinatlayithe, v table pointernu bharti cheyadam valla vaerae chirunama (bahusha exploit kodnu soochinchadam) pilavabadavacchu. pratyamnaayamgaa, memareeki vraayadaaniki pointernu upayoginchinatlayithe, konni itara dayta nirmaanam paadaipovachhu. pointer velaadutunnappudu matrame memarini chadivinappatiki, adhi samachara leaklaku (aasaktikaramaina daetaanu akkada ketaayinchina tadupari nirmaanamloo unchinatlayithe) ledhaa pratyeka hakkula perugudalaku (ippudu chellani memarini bhadrata tanikheelalo upayoginchinatlayithe) daariteestundi. oka velaadutunna pointernu daaniki kotta memarini ketayinchakunda vidudala chesina tarvaata upayoginchinappudu, dheenini "uchita durbalatvam tarvaata upayogam" anie pilustaaru. udaaharanaku, microsoft internet explorer 6 nundi 11 varaku jeero-day daadula dwara upayoginchabadutunna upayogam-taruvaata-uchita durbalatvam anedi oka adhunaatana nirantara muppu.
thookam puuyadam pointer lopaalanu nivaarinchandi.
sii loe, saralamaina saanketikata emitante, pointer yokka reset kuu haamii ichhe coque _ 2 (ledhaa okela) function yokka pratyaamnaaya samskarananu amalu cheyadam. ayithe, eee saanketikata pointer yokka kaapeeni kaligi unna itara pointer chararaasulanu clear cheyadu.
/* uchitam ()' kosam pratyaamnaaya samskarana' */
static shoonya surakshitam (shoonya * * pp)
 / * debug modlo, pp shoonyamgaa unte nilipiveyandi */
 dhruvikarinchandi (pp);
 / * uchita (shoonya) sarigga panichestundi, kabatti debug modlo nokkicheppadam tappa vaerae check avasaram ledhu */
 uchitam (* pp);/* chankunu ketayinchakandi, uchitam (shoonyam) chellubaatu avtundani gamaninchandi */
 *pp = shoonya;/* asalu pointernu reset cheyandi */
intu eff (intu ii)
 chaara * p = shoonya, * p2;
 p = mallok (1000);/* oka chankunu pondandi */
 p2 = p;/* pointernu coppy cheyandi */
 / * ikkada chankunu upayoginchandi */
 surakshitam ((chellani * *) & p);/* bhadrata vimukti; p2 chararaasulanu prabhaavitam cheyadu */
 surakshitam ((chellani * *) & p);/* p anedi shoonyaaniki reset cheyabadinanduna eee rendava coll viphalamavvadu */
 chaar sii = * pii2;/* pii2 ippatikee velaadutunna pointer, kabatti idhi nirvachinchabadani pravartana. */
 tirigi i + c;
coque _ 1 kuu coll chese mundu khaalii pointer yokka chellubaatuku haamii ivvadaaniki kooda pratyaamnaaya samskarananu upayoginchavachhuh
 surakshitam (& p);/* chankunu vidudala chesaro ledho naaku teliyadu */
 p = mallok (1000);/* ippudu ketayinchandi */
eee upayogaalanu upayogakaramaina macrolanu nirminchadaaniki coque 10 aadesaala dwara musugu cheyavachu (oka saadhaaranamainadi coque 11), loha bhasha vantidaanni srushtistundi ledhaa vaerugaa saadhanaala librarylo ponduparachavacchu. prati sandarbhamloonuu, eee saanketikatanu upayoginche prograamarlu coque _ 2 upayoginchabade prati sandarbhamloonuu surakshitamaina samskaranalanu upayoginchaali; alaa cheyadamlo viphalamaithe mallee samasyaku daariteestundi. alaage, eee parishkaram oke karyakramam ledhaa project yokka paridhiki parimitam cheyabadindi mariyu sarigga document cheyabadaali.
marinta nirmaanaatmaka parishkaralalo, sii + + loe velaadutunna paayintarlanu nivaarinchadaaniki oka prasiddha saanketikata smart paayintarlanu upayoginchadam. smart pointer saadhaaranamgaa vastuvulanu tirigi pondadaaniki reference countingnu upayogistundi. konni itara paddhatulalo samadhi raalla paddhati mariyu taalaalu mariyu taalaalu paddhati unnaayi.
maroka vidhanam emitante, bohem chettha collectornu upayoginchadam, idhi oka sampradaaya chettha collector, idhi sii mariyu sii + + loe praamaanika memory ketayimpu vidhulanu chettha collectortho bharti chestundi. eee vidhanam freelanu nilipiveyadam dwara velaadutunna pointer lopaalanu puurtigaa tolagistundi mariyu chettha sekarana dwara vastuvulanu tirigi pondutundi.
jaava vanti bhaashalalo, velaadutunna pointerlu sambhavinchavu endukante memarini spashtamgaa ketaayinchadaaniki yantraangam ledhu. badulugaa, chettha collector memarini ketayinchavacchu, conny yea suuchanala nundi vastuvu cherukolenappudu matrame.
bhasha tuppu loe, rakam vyavastha kooda chararaasulu jeevitakaalaalu mariyu vanarula samuparjana praarambhinchadam chaerchadaaniki vistarinchabadindi. bhasha yokka lakshanaalanu nilipiveyakapothe, velaadutunna pointerlu sankalanam samayamlo pattubadataayi mariyu prograaming lopaluga nivedinchabadataayi.
velaadutunna pointer gurtimpu.
velaadutunna pointer lopaalanu bahirgatam cheyadaaniki, oka saadhaarana prograaming technic emitante, avi soochinche nilva vidudalaina tarvaata shoonya pointerku ledhaa chellani chirunamaku paayintarlanu sett cheyadam. shoonya suuchikanu (chaalaa bhaashalalo) suchinchabadanappudu programme ventane mugustundi-dayta avineeti ledhaa anoohya pravartanaku avakaasam ledhu. idhi antarleena prograaming porapatunu kanugonadam mariyu parishkarinchadam sulabhataram chestundi. pointer yokka bahula kaapeelu unnappudu eee saanketikata sahaayapadadu.
kontamandi debuggerlu saadhaaranamgaa coque 13 vanti nirdishta namuunaatoe vidudala cheyabadina daetaanu svayamchaalakamgaa bharti chesi naasanam chestaaru (udaaharanaku, microsoft vijuval sii/sii + + debugger, vidudala cheyabadina vaati aadhaaramgaa coque 14, coque 15 ledhaa coque 16 nuu upayogistundi). idhi saadhaaranamgaa daetaanu panikiraanidigaa mariyu chaalaa pramukhamainadigaa cheyadam dwara tirigi upayoginchakundaa nirodhistundi (eee namuunaa memory ippatike vidudala cheyabadindani prograamarku choopinchadaaniki upayogapadutundi).
velaadutunna pointerla upayogaalanu gurtinchadaaniki polyspace, total view, walgrind, mudflop, adrus sanitizer ledhaa llvm aadhaaramgaa pani chese saadhanaalanu kooda upayoginchavacchu.
itara sadhanalu (softbound, insurance + +, mariyu checkpointer) pointerlaku ("metadeta") chattabaddhamaina viluvalanu sekarinchadaaniki mariyu track cheyadaaniki soars kodnu instrument chestaayi mariyu chellubaatu kosam metadetaku vyatiraekamgaa prati pointer accessnu tanikhi chestaayi.
maroka vyuuham, oka chinna taragati samuuhaanni anumaaninchinappudu, vaari sabhyula vidhulannintinii tatkalikamga varchuvalga cheyadamh taragati udaaharana naasanam cheyabadina/vimukti cheyabadina tarvaata, virtual methed tableku daani pointer coque _ 17kii sett cheyabadutundi, mariyu member functionku edainaa coll prograamnu crash chestundi mariyu idhi debuggerlo dosha kodnu chooputundi.

