對於很多C++新手而言,對象或變數的sizeof資訊總是讓人捉摸不透,以下程式列舉了幾組典型的sizeof資訊,希望能解答大家在使用sizeof時的疑問。在列舉這幾個例子前需要說明以下幾點:1、在Win32平台上,指標長度都是4位元組,char*、int*、double*如此,vbptr(virtual base table pointer)、vfptr(virtual function table pointer)也是如此;2、對於結構體(或類),編譯器會自動進行成員變數的對齊,以提高運算效率
在使用String.split方法分隔字串時,分隔字元如果用到一些特殊字元,可能會得不到我們預期的結果。我們看jdk doc中說明public String[] split(String regex) Splits this string around matches of the given regular expression. 參數regex是一個 regular-expression的匹配模式而不是一個簡單的String,他對一些特殊的字元可能會出現你預想不到的結果,比如測試下面的代碼:
This article is refered from Padraig’s Blog. It's useful for me debuging Drizzle on remote machine: ) While working with Drizzle this week for my GSoC project, I’ve been going through the source code to understand how INFORMATION_SCHEMA is currently
Google編程大賽的題目的確對演算法、思維能力是一個考驗,在一個小時內完成的確是有點難度。經過檢驗,才發現自己在這方面平時的確比較欠缺呀。這道題我可是做了近半天才作完整了,跑通了題目給出的所有case。原題:Problem StatementYou are given a String[] grid representing a rectangular grid of letters. You are also given a String find, a word you are to
//先序遍曆的非遞迴演算法 private void preOrderTraverse(BinTreeNode rt, LinkedList list){ if (rt==null) return; BinTreeNode p = rt; Stack s = new StackSLinked(); while (p!=null){ while (p!=null){ //向左走到盡頭 list.insertLast(p);