Sunday, November 16, 2008

C++: Anonymous namespaces

The C++ standard now says that the use of the static keyword to declare a file-scope varible as non-externally linkable is deprecated in favour of declaring it inside an anonymous namespace, that is, a namespace with no name. Such variables are guaranteed to be local to that file and can be named concisely without fear of clashes or polluting the global namespace.

That is until you want to start doing unity builds. Unity building is the pre-build process of taking all the .cpp files in a C++ project and #includeing them into a single .cpp file, and then only compiling that single file. Apparently (and surprisingly) this compiles many, many times faster than using seperate files (perhaps because of reduced disc accesses?) at least it does within Visual Studio 2005.

The main point is that you should always to endeavour to make all your variable names unique as you never know when that scope could change.

39 comments:

zordeak said...

please check this links out to know what's happening in GAZA,, and to know about the Zionism crime.

http://gazatoday.blogspot.com/
http://affendina.blogspot.com/
http://al-roban.blogspot.com/2009/01/untitled_08.html



please publish this facts to let the world know about the real terrorism.

thank you very much.

Francoise said...

本土線上成人短片本土美腿自拍照本土美女做愛本土美少女本土自貼本土自啪本土自啪天堂本土自幹本土自拍片本土自拍絲襪女本土自拍網本土自拍線上觀賞本土自拍貼片本土自拍貼圖網本土辣妹影片本土做愛自拍本土女優本日美女圖片朱俐靜走光杉本彩寫真圖李麗珍寫真集李麗珍寫真圖片李冠儀李冠儀寫真李冠儀性感照李毓芬寫真杜蕾絲a漫杜蕾絲線上看杜蕾絲aa片免費杜蕾絲免費杜蕾絲成人杜蕾思杜蕾斯論壇杜蕾斯網本地免費成人片本地av影片本土潮吹本土字拍天堂本土學生做愛照片本土少女本土性愛

手ˊ震 said...

每個人生命中都可能遇到貴人,這些貴人不一定真的尊貴,他可能是陌生人,也可能是你的敵人。..................................................

開心唷 said...

thx u very much, i learn a lot

冠宇 said...

豆豆聊聊天080人聊天室尋夢元聊天性愛性交性愛線上gogo成人網gogo成人影片gogo色情gogo258影片gogo258goav線上go2色情影片網go2免費ago2免費a片go2免費成人影片go2免費影片卡通go2免費影片觀看go2亞洲免費影片go2線上a片go2線上免費go2線上影片go3avgoav成人網goav免費影片線上gogo色情網gogo色情影片hi免費影片hk免費影城hot情色httpsex520net視訊辣妹亞洲情色風暴貼圖ut男同志聊天室情色視訊

玉苓 said...

你可以從外表的美來評論一朵花或一隻蝴蝶,但你不能這樣來評論一個人........................................

劉承合 said...

閒暇為所有財富中最美好的財富 ..................................................

偉倫 said...

how do u do?xvideo打飛機專用網洪爺免費洪爺色情片洪爺貼圖區洪爺成人線上洪爺影城洪爺色論壇洪爺貼圖洪爺成年人網洪爺免費色情洪爺色情貼援交妹辣妹野球拳情色文學情趣聊天室性感辣妹裸體遊戲做愛偷拍一夜情視訊洪爺色情貼洪爺免費色情洪爺成年人網洪爺貼圖洪爺色論壇洪爺影城洪爺成人線上洪爺貼圖區洪爺色情片洪爺免費洪爺色情貼洪爺免費色情洪爺成年人網洪爺貼圖洪爺色論壇洪爺影城洪爺成人線上洪爺貼圖區洪爺色情片洪爺免費洪爺免費洪爺色情片洪爺貼圖區洪爺影城洪爺色論壇洪爺貼圖洪爺成年人網洪爺免費色情洪爺色情貼洪爺成人線上

AronSpriggs0223 said...

笑口常開~~天天開心........................................

Denny0417Mahurin said...

我對自己的信心已超越別人對我的評價........................................

GeraldF_Rotter雅慧 said...

非常感謝~3Q~....................................................

OliveWol8888 said...

Drive carefully. It is not only cars that can be recalled by their Maker. ....................................................

韋于倫成 said...

很棒的分享~希望不會打擾您 ........................................

韋于倫成 said...

讓人流連忘返,真期待新文章發表! .........................................

桂竹桂竹 said...

生命的意義,是在於活的充實;而不是在於活得長久。 ..................................................

筠銘 said...

過去的事早已消失,未來的更是渺不可知,只有現在是真實的。........................................

俊翔劉 said...

恨一個人,比原諒一個人,更傷力氣。............................................................

tyroneb said...

我的痛苦會停止,但求我的心能征服它。........................................

GlenS_Mielke12嘉偉17 said...

閒來無聊逛逛blog~~跟您打聲招呼~~.................................................................

美方 said...

當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................

吳婷婷 said...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

宥妃宥妃 said...

hi!~~leave you a message to say hello, and thanks for your share!..................................................................

偉軍 said...

No one knows the weight of anothers burden. ............................................................

吳玉婷 said...

當你真心渴望某一樣東西,整個宇宙都會聯合起來幫助你。..................................................

陳佑發 said...

人若賺得全世界,賠上自己的靈魂,有什麼益處?.......................................................

馥虹 said...

享受你自己的生活,不要與他人相比。............................................................

家榮家榮 said...

很用心的部落格 祝你人氣百分百 期待您的新文章...........................................................

俊成俊成 said...

要求適合自己的愛情方式,是會得到更多,還是會錯過一個真正愛你的人。.................................................................

陳晏李秀樺雄 said...

生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ToryO_Vis建銘 said...

優質的好部落格,需要大家的支持!..................................................................

木楊楊堯木楊楊堯 said...

困難的不在於新概念,而在於逃避舊有的概念。............................................................

陳劉嘉韋蓉宣 said...

你不能改變容貌~~但你可以展現笑容.................................................................

承王蓁 said...

真正仁慈的人,會忘記他們做過的善行,他們全心投入現在的工作,過去的事已被遺忘。.................................................

4464 said...

心中醒,口中說,紙上作,不從身上習過,皆無用也。..................................................

于庭吳 said...

你的部落格感覺很棒,nice job!............................................................

1615 said...

你文章很棒的~繼續分享給大家~~~~..................................................

翊翊翊翊張瑜翊翊翊 said...

看著你的BLOG 好多朋友都回應 真厲害............................................................

黃英吳思潔吳思潔邦 said...

期待你的下次更新喔^____^..................................................

司冯欣 said...

讓好心情回味發酵;壞心情留在文字裡隨時間消逝吧!............................................................