Ana Menü
· Ana Sayfa
· Dosyalar
· Dökümanlar
· Forum
· Günün Resmi
· Haber Arşivi
· WWW Linkleri
· Üye Listesi

     Forumlar

 strncpy ve strncpy_s
 Konu adi : Borland c++ Builder ile Amiral Batti
 Rady10 - YerliOyun
 Kabusta Kaybolmak
 Konsol da programı bekletmek
 Oyun programlama icin hangi programlama dilli ?
 flash! şanlıurfa bilgisayar oyununda(no rapid)
 Sevgilim Olur musun?
 Directx'e başlamak isteyenler bi bakın
 PSP programlama
 Flash tan php
 Bilgisyr oyunu yapmam için üniverstde hangi bölüme girmeliym
 www.arshiv.gen.ms
 Cimg.h ilgilenenler icin
 müttefik oyunu

Konu Disi
 Emraah
 Yeni sitemiz açıldı
 Kalp krizi durumunda ne yapılmalı?
 Oyun sektöründe hangi görevde çalışmak isterdiniz?
 Takım arkadaşı sorunu
 msn de renklı nıck
 pc hata veriyor ! YARDIM!!
 Gülmek isteyenler Buraya
 İnanılmaz hl 2 modu görüntüsü
 Computer Languages History

[ Forumlara Git ]


oyunyapimi.org: Forums

www.oyunyapimi.org :: Başlığı Görüntüle - global de static
 SSSSSS   AramaArama   Kullanıcı GruplarıKullanıcı Grupları   ProfilProfil   LoginLogin 

global de static

 
Yeni Başlık Gönder   Cevap Gönder    www.oyunyapimi.org Forum Ana Sayfası -> Programlama Dilleri ve Algoritmalar
Önceki başlık :: Sonraki başlık  
Yazar Mesaj
Arda



Kayıt: Feb 25, 2003
Mesajlar: 226

MesajTarih: Thu Jul 29, 2004 10:27 am    Mesaj konusu: global de static Alıntıyla Cevap Ver

Başka .cpp kaynak dosyaları tarafından çağırılabilen bir interface (arabirim) fonksiyonum var. Bu fonksyonun içinde static değişken yaratmanın manası nedir? Zaten fonksyon çağırıldığında sonuna gelene kadar işlenecek ve bu işlem bittiğinde içindeki değişkenlerinde ömrü sona erecek. Acaba static yapınca sona ermiyor mu? Eğer öyleyse bunu fonksiyon dışında declare etmek daha mantıklı olmaz mı?

(bugün soru sorasım var, bezdim şu kodu 2-3 gündür çözmeye çalışıyorum Evil or Very Mad )
Başa dön
Kullanıcı profilini gör MSN Messenger
cemuzunlar



Kayıt: Aug 03, 2003
Mesajlar: 49

MesajTarih: Thu Jul 29, 2004 10:40 am    Mesaj konusu: Alıntıyla Cevap Ver

ilk once bahsettigin islemlerin, c++ ve class'lar yardimiyla daha hos sekilde cozulebilecegini soyleyeyim.

fonksiyonun icinde static olarak tanimlama yapilmis bir degisken, fonksiyondan cikildiktan sonra da yasamaya devam eder. Bu degiskeni global olarak tanimlamak da mumkundur, ama tasarim acisindan hos degildir. Cunku, sadece bu fonksiyonun erismesi gereken bir degiskene, kodun her yerinden erisimi acmis olursun.
Başa dön
Kullanıcı profilini gör E-Posta'yı gönder Kullanıcının web sitesini ziyaret et MSN Messenger
Arda



Kayıt: Feb 25, 2003
Mesajlar: 226

MesajTarih: Thu Jul 29, 2004 10:50 am    Mesaj konusu: Alıntıyla Cevap Ver

hm anladım sağolasın Very Happy Very Happy

Bu arada okuduğum ve kullanmaya çalıştığım kod mimarisi GameDev'deki Code on the Cob serisine ait. Chris Hargrove C++/Class kullanımı ve klasik C stili kod kullanışının nedenlerini kısaca(!) şu şekilde anlatmış:

Class Exposure

C++ has a few language problems that make abusing top-down design and inheritance an unwise idea simply from a practicality standpoint. One is the fact that it's too easy to inherit from concrete classes that were never intended to be inherited from. But the biggest one in my eyes is class exposure, an inherent problem in the way C++ classes are created. When you write a class, both public and private data members and method functions are declared, and the class is usually placed in a header file so it can be used by others. The public stuff is not a problem, as that needs to be there (it's the interface to the class after all). But so does the private stuff, and that's bad.

What you've got is a situation where everything using a class knows the private organization of that class, and any time you want to change that organization, the change is exposed to everything uses that class, requiring recompilation. Such compile-time dependencies are insignificant early in a project, but can become a major productivity hit when the codebase gets big enough. This is different than interface/implementation separation in C, where static "private" variables and functions of a subsystem are only listed in a .c/.cpp source file and not in a header, so changing them only requires that one file to be recompiled. Putting an equivalent subsystem in a C++ class would add significantly more compile-time dependencies. It would also expose the internal structure of that subsystem to everything outside it.

This is one of the big reasons I stick with mostly C-like interfaces when possible, even in C++ code. When anything dealing with implementation is exposed, black-box separation is broken, and I don't want that. I'll use C++ classes when they make sense and the benefits outweigh the costs, but I'm not about to incur those costs and invite entropy for no good reason.

Even when my code isn't object-oriented at the physical level in C++, it's object-oriented at the logical level, to such an extreme degree that C++ itself automatically damages encapsulation. So if people look at my C-like interfaces and start wondering whether I know anything about object-oriented programming, my egotistical response is "damn right I do". Smile C++ is a language that likes to tempt you, and it has many temptations that are worth taking from time to time. But don't blindly abuse it just so you can pretend you're being object-oriented. Object-orientation and good design go far beyond the keyword "class".

Dokümanın devamı için: tıkla!
Başa dön
Kullanıcı profilini gör MSN Messenger
Mesajları göster:   
Yeni Başlık Gönder   Cevap Gönder    www.oyunyapimi.org Forum Ana Sayfası -> Programlama Dilleri ve Algoritmalar Tüm saatler GMT +2 Saat
1. sayfa (Toplam 1 sayfa)

 
Forum Seçin:  
Bu forumda yeni konular açamazsınız
Bu forumdaki mesajlara cevap veremezsiniz
Bu forumdaki mesajlarınızı değiştiremezsiniz
Bu forumdaki mesajlarınızı silemezsiniz
Bu forumdaki anketlerde oy kullanamazsınız


Powered by phpBB 2.x.x © 200x phpBB Group
Türkçe Çeviri : Onur Turgay & Erdem Çorapçıoğlu
Türkçe Düzenleme: Alexis Canver
Version 2.x.x of PHP-Nuke Port by Tom Nitzschner © 200x www.toms-home.com




Web site powered by PHP-Nuke
Web site engine\'s code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Sayfa Üretimi: 0.117 Saniye