Re: [問卦] 資工系不會指標怎麼辦?

作者: KILLE (啃)   2017-04-06 14:23:07
※ 引述《Uniqueness (noman)》之銘言:
: 指標,c語言系列的門神
: 所有入門的人幾乎都會在指標卡住
: 餘下就是看自身資質看可以多久突破這個門神
: 但縱觀所有程式語言,只有c語言有指標的概念
: 所以我說,不會指標應該也沒什麼關係吧?
智慧是解決問題 大智慧是讓問題不存在
教你一招 讓你不要再面對奇怪的指針問題
詳見這網頁 有五本書可下載
https://software.intel.com/en-us/articles/intel-sdm
#include <stdio.h>
char format[] = "%s %s\n";
char hello[] = "Hello";
char world[] = "earth";
int main(int argc, char *argv[])
{
#ifdef _MSC_VER
__asm
{
mov eax, offset world
push eax
mov eax, offset hello
push eax
mov eax, offset format
push eax
call printf
}
#endif
#ifdef __GNUC__
asm(".intel_syntax noprefix");
asm("mov eax, offset world");
asm("mov eax, offset hello");
asm("push eax");
asm("mov eax, offset format");
asm("push eax");
asm("call printf");
#endif
}
學甚番邦胡語 直接面向處理器母語吧 擺除指針 就從內聯匯編開始
作者: Kevin10613 (阿一)   2017-04-06 14:24:00
大概是這樣沒錯
作者: Uniqueness (唯一性)   2017-04-06 14:25:00
跟我想的一樣
作者: ekpyrosis   2017-04-06 14:25:00
嫩 我只直寫0101 你還在組語
作者: Xuxxin (Xuxin)   2017-04-06 14:27:00
hello world
作者: lovealgebra (calculus)   2017-04-06 14:30:00
是用Stack?
作者: bluebluelan (新陰流大目錄免許皆傳)   2017-04-06 14:33:00
結果你還不是在寫C
作者: vowpool (不要丟我銅板)   2017-04-06 14:38:00
寫啥組語啦 很難懂耶
作者: wemee (方天畫)   2017-04-06 14:39:00
把 $1, $2 相加的結果 放到$3啦
作者: a2470abc (D.F.)   2017-04-06 14:55:00
組語喔 .....跳過
作者: JackChung (小鍾鍾)   2017-04-06 15:18:00
inline assembly 雙刃劍啦 自己斷絕讓 compiler 再幫你最佳化的空間

Links booklink

Contact Us: admin [ a t ] ucptt.com