5c ios10系統(tǒng)卿拴,debug一切正常衫仑, adhoc 環(huán)境下就崩潰問題

5c ios10系統(tǒng),debug一切正常堕花, adhoc 環(huán)境下就崩潰文狱,小伙伴查了很久發(fā)現(xiàn)是一個(gè)配置項(xiàng)引起

在buildsetting中, 找到optimization level 缘挽, debug環(huán)境設(shè)置的是none瞄崇, a d ho c環(huán)境設(shè)置的是smallest fastest ,若把a(bǔ) d ho c 環(huán)境設(shè)置為none就解決了壕曼。?

這個(gè)編譯策略呢苏研,就是編譯器的優(yōu)化程度。早期因?yàn)橛布Y源不夠強(qiáng)大腮郊,編譯器在編譯過程中會(huì)對(duì)代碼進(jìn)行優(yōu)化摹蘑,提高代碼的效率。不過這個(gè)優(yōu)化過程轧飞,因?yàn)楸容^靠近硬件一層纹蝴,所以可能導(dǎo)致一些不兼容的問題庄萎。

很多Release包有問題而Debug包沒問題,就是因?yàn)镽elease默認(rèn)的是Fastest,Smallest而Debug默認(rèn)是None

作者:悟空沒空

鏈接:http://www.reibang.com/p/8637d95fe558

來源:簡(jiǎn)書

簡(jiǎn)書著作權(quán)歸作者所有塘安,任何形式的轉(zhuǎn)載都請(qǐng)聯(lián)系作者獲得授權(quán)并注明出處糠涛。

查了一下optimization level 代表的意義:

6.3.1.3 Optimization Levels

Without any optimization option, the compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the subprogram and get exactly the results you would expect from the source code.

Turning on optimization makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program.

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

The default is optimization off. This results in the fastest compile times, but GNAT makes absolutely no attempt to optimize, and the generated programs are considerably larger and slower than when optimization is enabled. You can use the?-O?switch (the permitted forms are?-O0,?-O1?-O2,?-O3, and?-Os) to?gcc?to control the optimization level:

*?

-O0

No optimization (the default); generates unoptimized code but has the fastest compilation time.

Note that many other compilers do substantial optimization even if ’no optimization’ is specified. With gcc, it is very unusual to use?-O0?for production if execution time is of any concern, since?-O0?means (almost) no optimization. This difference between gcc and other compilers should be kept in mind when doing performance comparisons.

*?

-O1

Moderate optimization; optimizes reasonably well but does not degrade compilation time significantly.

*?

-O2

Full optimization; generates highly optimized code and has the slowest compilation time.

*?

-O3

Full optimization as in?-O2; also uses more aggressive automatic inlining of subprograms within a unit (Inlining of Subprograms) and attempts to vectorize loops.

*?

-Os

Optimize space usage (code and data) of resulting program.

Higher optimization levels perform more global transformations on the program and apply more expensive analysis algorithms in order to generate faster and more compact code. The price in compilation time, and the resulting improvement in execution time, both depend on the particular application and the hardware environment. You should experiment to find the best level for your application.

Since the precise set of optimizations done at each level will vary from release to release (and sometime from target to target), it is best to think of the optimization settings in general terms. See the `Options That Control Optimization' section in?Using the GNU Compiler Collection (GCC)?for details about the?-O?settings and a number of?-f?options that individually enable or disable specific optimizations.

Unlike some other compilation systems,?gcc?has been tested extensively at all optimization levels. There are some bugs which appear only with optimization turned on, but there have also been bugs which show up only in `unoptimized' code. Selecting a lower level of optimization does not improve the reliability of the code generator, which in practice is highly reliable at all optimization levels.

Note regarding the use of?-O3: The use of this optimization level ought not to be automatically preferred over that of level?-O2, since it often results in larger executables which may run more slowly. See further discussion of this point in?Inlining of Subprograms.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市兼犯,隨后出現(xiàn)的幾起案子忍捡,更是在濱河造成了極大的恐慌,老刑警劉巖切黔,帶你破解...
    沈念sama閱讀 219,490評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件砸脊,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡纬霞,警方通過查閱死者的電腦和手機(jī)凌埂,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,581評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來诗芜,“玉大人瞳抓,你說我怎么就攤上這事》郑” “怎么了孩哑?”我有些...
    開封第一講書人閱讀 165,830評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)翠桦。 經(jīng)常有香客問我横蜒,道長(zhǎng),這世上最難降的妖魔是什么销凑? 我笑而不...
    開封第一講書人閱讀 58,957評(píng)論 1 295
  • 正文 為了忘掉前任丛晌,我火速辦了婚禮,結(jié)果婚禮上斗幼,老公的妹妹穿的比我還像新娘茵乱。我一直安慰自己,他們只是感情好孟岛,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,974評(píng)論 6 393
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著督勺,像睡著了一般渠羞。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上智哀,一...
    開封第一講書人閱讀 51,754評(píng)論 1 307
  • 那天次询,我揣著相機(jī)與錄音,去河邊找鬼瓷叫。 笑死屯吊,一個(gè)胖子當(dāng)著我的面吹牛送巡,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播盒卸,決...
    沈念sama閱讀 40,464評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼骗爆,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來了蔽介?” 一聲冷哼從身側(cè)響起摘投,我...
    開封第一講書人閱讀 39,357評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎虹蓄,沒想到半個(gè)月后犀呼,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,847評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡薇组,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,995評(píng)論 3 338
  • 正文 我和宋清朗相戀三年外臂,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片律胀。...
    茶點(diǎn)故事閱讀 40,137評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡宋光,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出累铅,到底是詐尸還是另有隱情跃须,我是刑警寧澤,帶...
    沈念sama閱讀 35,819評(píng)論 5 346
  • 正文 年R本政府宣布娃兽,位于F島的核電站菇民,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏投储。R本人自食惡果不足惜第练,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,482評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望玛荞。 院中可真熱鬧娇掏,春花似錦、人聲如沸勋眯。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,023評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)客蹋。三九已至塞蹭,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間讶坯,已是汗流浹背番电。 一陣腳步聲響...
    開封第一講書人閱讀 33,149評(píng)論 1 272
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人漱办。 一個(gè)月前我還...
    沈念sama閱讀 48,409評(píng)論 3 373
  • 正文 我出身青樓这刷,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親娩井。 傳聞我的和親對(duì)象是個(gè)殘疾皇子暇屋,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,086評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,336評(píng)論 0 10
  • 目錄 | 只有讓自己堅(jiān)定不已 上一章 文/小談話 不同地方,不同方向的人撞牢,報(bào)著同樣的想法率碾,有主題地聚集在一塊兒,就...
    小踏花閱讀 201評(píng)論 14 1
  • 王允巧施美人計(jì)屋彪,貂蟬屈身為百姓所宰。先嫁董卓后嫁布,義子弒父此事成畜挥。
    套路大師閱讀 219評(píng)論 0 1
  • 假設(shè)仔粥,X1~Xn具有聯(lián)合概率分布: Some Notions: likelihood of a observed ...
    Qinginging閱讀 708評(píng)論 0 0