關於此語法 delete [] abc 是何意? |
答題得分者是:brook
|
seeing
初階會員 ![]() ![]() 發表:49 回覆:131 積分:41 註冊:2002-11-07 發送簡訊給我 |
|
brook
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:57 回覆:323 積分:371 註冊:2002-07-12 發送簡訊給我 |
|
gemi0305
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:81 回覆:564 積分:629 註冊:2003-05-11 發送簡訊給我 |
|
zilch
中階會員 ![]() ![]() ![]() 發表:5 回覆:87 積分:78 註冊:2002-09-24 發送簡訊給我 |
依據 C 的爸爸 Bjarne Stroustrup 的 "The C Programming Language, 2nd ed."
一書的 "Reference Manual" 中, Section r5.3.3 所述: The lifetime of an object created by new is not restricted to the
^^^
scope in which it is created. Section r.5.3.4: The form
delete [] cast-expression
^^^^^^^^^
is used to delete arrays.
......
The effect of deleting an array with the plain delete syntax is
^^^^^^
undefined, as is deleting an individual object with the delete[]
syntax. ^^^^^^^^
|
seeing
初階會員 ![]() ![]() 發表:49 回覆:131 積分:41 註冊:2002-11-07 發送簡訊給我 |
|
brook
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:57 回覆:323 積分:371 註冊:2002-07-12 發送簡訊給我 |
引言: 可是如果照brook所寫的原始碼來看,是先delete abc,再delete陣列 |
seeing
初階會員 ![]() ![]() 發表:49 回覆:131 積分:41 註冊:2002-11-07 發送簡訊給我 |
|
gemi0305
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:81 回覆:564 積分:629 註冊:2003-05-11 發送簡訊給我 |
|
seeing
初階會員 ![]() ![]() 發表:49 回覆:131 積分:41 註冊:2002-11-07 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |