<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      川山甲

      追求內(nèi)心的非常平靜!瞬間清空所有的雜念,達(dá)到物我兩忘!

        博客園  :: 首頁  ::  :: 聯(lián)系 :: 訂閱 訂閱  :: 管理
       
      介紹
       
       
        現(xiàn)在C語言跨的領(lǐng)域非常之多,如游戲、嵌入式、智能電器等。為什么不直接用匯編或機(jī)器語言直接寫呢?原因是匯編和機(jī)器語言受到計(jì)算機(jī)體系結(jié)構(gòu)的影響。直接用某種體系結(jié)構(gòu)的匯編或機(jī)器指令寫出來的程序只能在這種體系結(jié)構(gòu)的計(jì)算機(jī)上運(yùn)行
       
        C語言的好處是各種體系結(jié)構(gòu)的計(jì)算機(jī)都有各自的C編譯器,可以把C程序編譯成各種不同體系結(jié)構(gòu)的機(jī)器指令,這意味著用C語言寫的程序只需稍加修改甚至不用修改就可以在各種不同的計(jì)算機(jī)上編譯運(yùn)行
       

        
      hello,world
       
        我們從簡單hello,world開始——有人說了,又來了,這個(gè)“hello,world”,好多博友都寫這種東西煩不煩?呵呵,那我寫的也許跟他們說的不一樣呢?或者理解的跟別人有不一樣的地方。
       
        先寫個(gè)程序我們看看。
        
      源程序(或者源文件):是程序員通過文本編輯器創(chuàng)建并保存的文本文件。
      源程序?qū)嶋H就是由0和1組成的位序列,這些位8個(gè)一組,成為字節(jié),每個(gè)字節(jié)通過ASCII字符集(大部分是)對應(yīng)一個(gè)文本字符。
                                       下面是上面程序?qū)?yīng)的16進(jìn)制數(shù)字表示

                                        在終端輸入man ascii看看ascii表

      操作步驟:

                   

                   查看16進(jìn)制格式

                   回復(fù)到文本格式

       

                                       我們看看對應(yīng)的二進(jìn)制是什么樣的?——這個(gè)也是在磁盤中的存儲狀態(tài)。

       

       
      總結(jié):
        系統(tǒng)中所有的信息——包括磁盤文件、存儲器中的程序,存儲器中存放的用戶數(shù)據(jù)以及網(wǎng)絡(luò)上傳送的數(shù)據(jù),都是由一串比特表示的。
       
      思考:
        同樣的一套字節(jié)序列可能在不同的上下文中表示一個(gè)整數(shù)、浮點(diǎn)數(shù)、字符串或者機(jī)器指令。——這取決于數(shù)據(jù)對象的上下文。
       
      我們該做什么?
        做為程序員,我們需要了解數(shù)字的機(jī)器表示方式,因?yàn)樗鼈兣c常見的整數(shù)和實(shí)數(shù)是不同的。
       
      使用參考:
       

       
      翻譯
       
        
       
        源程序是能夠被人讀懂的,為了能在系統(tǒng)上運(yùn)行,我們需要把C語句通過其他程序轉(zhuǎn)化為一系列的低級機(jī)器語言指令。然后這些指令按照一種稱為“可執(zhí)行目標(biāo)程序“的格式打包好,并以二進(jìn)制磁盤文件的形式存放起來。
       
        在Linux系統(tǒng)上,從源文件到目標(biāo)文件(可執(zhí)行目標(biāo)程序文件)的轉(zhuǎn)化是由編譯器驅(qū)動程序完成的。如下圖:

      編譯系統(tǒng)

        我們用GCC工具觀察每個(gè)階段。(GCCGNU Compiler CollectionGNU編譯器套裝
       
      先贈送一張gcc命令選項(xiàng)圖
       

       
      預(yù)處理階段

                                       查看main.i的部分源碼

      總結(jié):預(yù)處理器(cpp)根據(jù)以字符#開頭的命令,修改原始C程序,結(jié)果得到了另一個(gè)C程序(還是C程序),通常以i做為文件擴(kuò)展名。

       編譯階段

       

                                       查看main.s的源碼

       

      總結(jié):將C語言文本文件翻譯成匯編語言文本文件。——匯編語言是非常有用的,因?yàn)樗鼮椴煌呒壵Z言的不同編譯器提供了通用的輸出語言。

       

       匯編階段
       

                                       打開源代碼,注意此時(shí)為二進(jìn)制磁盤文件,還有注意操作步驟

                                       此時(shí)為亂碼,需要進(jìn)行:%!xxd操作

                                       查看指令

       

      總結(jié):匯編器(as)將main.s翻譯成機(jī)器語言指令,把這些指令打包成為一種“可重定位目標(biāo)程序“的格式,并將結(jié)果保存到main.o文件中,main.o是二進(jìn)制文件,它的字節(jié)編碼是機(jī)器語言指令而不是字符(所以用文本編譯器看會出現(xiàn)亂碼)。

       

       鏈接階段
       

                                       按照匯編階段操作,查看部分指令碼

       

      總結(jié):程序中調(diào)用了printf函數(shù),它是C標(biāo)準(zhǔn)庫的一個(gè)函數(shù),printf函數(shù)存在于一個(gè)名為printf.o的單獨(dú)的預(yù)編譯目標(biāo)文件中。連接器(ld)負(fù)責(zé)把printf.o的預(yù)編譯目標(biāo)文件進(jìn)行并入,結(jié)果就得到a.out文件。

      NOTE:a.out是可執(zhí)行的目標(biāo)文件,而main.o是可重定位目標(biāo)程序文件。——可執(zhí)行目標(biāo)文件加載到系統(tǒng)存儲器后,由系統(tǒng)負(fù)責(zé)執(zhí)行。而可重定位目標(biāo)程序文件是提供給鏈接器使用,執(zhí)行并入操作。

       
      總結(jié)
       
        這一篇主要是學(xué)習(xí)gcc編譯器的編譯過程,對整個(gè)過程有所熟悉。如果有好的知識點(diǎn),望大家賜教。
       
        要知后事如何,且聽下回分解。
       
      推薦
       
       
      vim配置分享
      " An example for a vimrc file.
      "
      " Maintainer:   Bram Moolenaar <Bram@vim.org>
      " Last change:  2006 Nov 16
      "
      " To use it, copy it to
      "     for Unix and OS/2:  ~/.vimrc
      "         for Amiga:  s:.vimrc
      "  for MS-DOS and Win32:  $VIM\_vimrc
      "       for OpenVMS:  sys$login:.vimrc
      
      " When started as "evim", evim.vim will already have done these settings.
      if v:progname =~? "evim"
        finish
      endif
      
      " Use Vim settings, rather then Vi settings (much better!).
      " This must be first, because it changes other options as a side effect.
      set nocompatible
      
      " allow backspacing over everything in insert mode
      set backspace=indent,eol,start
      
      if has("vms")
        set nobackup      " do not keep a backup file, use versions instead
      else
        set nobackup      " keep [NO] backup file
      endif
      set history=250     " keep 250 lines of command line history
      set ruler       " show the cursor position all the time
      set showcmd     " display incomplete commands
      set incsearch      " do incremental searching
      set nu
      
      " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
      " let &guioptions = substitute(&guioptions, "t", "", "g")
      
      " Don't use Ex mode, use Q for formatting
      map Q gq
      
      " In many terminal emulators the mouse works just fine, thus enable it.
      set mouse=a
      
      " Switch syntax highlighting on, when the terminal has colors
      " Also switch on highlighting the last used search pattern.
      if &t_Co > 2 || has("gui_running")
        syntax on
        set hlsearch
      endif
      
      " Only do this part when compiled with support for autocommands.
      if has("autocmd")
      
        " Enable file type detection.
        " Use the default filetype settings, so that mail gets 'tw' set to 72,
        " 'cindent' is on in C files, etc.
        " Also load indent files, to automatically do language-dependent indenting.
        filetype plugin indent on
      
        " Put these in an autocmd group, so that we can delete them easily.
        augroup vimrcEx
        au!
      
        " For all text files set 'textwidth' to 78 characters.
        autocmd FileType text setlocal textwidth=78
      
        " When editing a file, always jump to the last known cursor position.
        " Don't do it when the position is invalid or when inside an event handler
        " (happens when dropping a file on gvim).
        autocmd BufReadPost *
          \ if line("'\"") > 0 && line("'\"") <= line("$") |
          \   exe "normal! g`\"" |
          \ endif
      
        autocmd VimLeave *
          \ if has("mksession") && exists("v:this_session") && v:this_session != "" |
          \   exec "mksession!" v:this_session |
          \ endif
      
        augroup END
      
      else
      
        set autoindent        " always set autoindenting on
      
      endif " has("autocmd")
      
      " Convenient command to see the difference between the current buffer and the
      " file it was loaded from, thus the changes you made.
      command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
              \ | wincmd p | diffthis
      
      " Add by Journeylee to make things more easily
      set softtabstop=4
      set shiftwidth=4
      set tabstop=4
      set noexpandtab
      set smarttab
      set showmatch
      set foldenable
      set autoindent
      set smartindent
      set cindent
      set foldmethod=marker
      set background=dark
      set nobackup
      
      set encoding=utf-8
      language en_US.utf8
      set fileencodings=ucs-bom,utf-8,gbk,latin1
      set fileformats=unix,dos,mac
      set fileencoding=utf-8
      set fileformat=unix
      
      set fileformat=unix
      set matchtime=15
      
      " Make shift-insert work like in Xterm
      map <S-Insert> <MiddleMouse>
      map! <S-Insert> <MiddleMouse>
      
      " let xterm16_brightness = 'default'     " Change if needed
      " let xterm16_colormap = 'allblue'       " Change if needed
      " colo xterm16 
      
      
      "不使用swap文件
      
      map <F5> :!php -l %<CR>
      
      "set runtimepath+=/home/zhoubc/opt/vim/doc
      "autocmd BufNewFile,Bufread *.ros,*.inc,*.php set keywordprg="help"
      
      let g:winManagerWindowLayout='TagList|FileExplorer'
      let g:winManagerWidth=30
      nmap  wm :WMToggle

       

      posted on 2012-06-23 14:21  川山甲  閱讀(3142)  評論(18)    收藏  舉報(bào)
      主站蜘蛛池模板: 青草青草视频2免费观看| 国产国产午夜福利视频| 国产一区二区精品久久呦| 在线 欧美 中文 亚洲 精品| 一区二区三区无码高清视频 | 精品一区二区中文字幕| 亚洲国产亚洲综合在线尤物| 女同另类激情在线三区| 国产农村老太xxxxhdxx | av无码免费一区二区三区| 国产精品女生自拍第一区| 精品国产高清中文字幕| 国产妇女馒头高清泬20p多| 久久精品国产91精品亚洲| 成人免费A级毛片无码片2022| 无码伊人久久大杳蕉中文无码| 国内自拍av在线免费| 亚洲av激情一区二区三区| 18禁免费无码无遮挡不卡网站| 精品无码一区在线观看| 亚洲一区av在线观看| 77se77亚洲欧美在线| 99精品伊人久久久大香线蕉| 国产精品高清中文字幕| 国产成人99亚洲综合精品| 最近中文字幕国产精品| 国产999精品2卡3卡4卡| 国产成人片无码视频在线观看| 午夜色无码大片在线观看免费| 人妻激情一区二区三区四区| 99午夜精品亚洲一区二区| 国产日韩av二区三区| 久久精品一本到99热免费| 靖宇县| 国产熟妇另类久久久久久| 激情综合色综合啪啪开心| 亚洲欧美人成网站在线观看看| 99久久精品久久久久久婷婷| 激情五月日韩中文字幕| 国产日韩av二区三区| 亚洲中文字幕无码不卡电影|