




已阅读5页,还剩42页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1,ATourofComputerSystems(2),C,2,Outline,LayersofcomputersystemsSuggestedreading4asidesinchapter1,CompilersAutumn2002,3,LayersofComputerSystems,CompilersAutumn2002,4,Utilities,ProgramminglanguageANSICCompilerGNU-gccToolsGNUtoolchain,eclipse(CDT),CompilersAutumn2002,5,GNU,FreesoftwareRichardStallman,1984AcompleteUnix-likesystemwithsourcecodeAnenvironmentAllmajorcomponentsofaUnixoperatingsystemExceptforkernel,CompilersAutumn2002,6,Platforms,HardwareplatformIntelIA-32OperatingsystemLinuxProgramminglanguageANSICUtilityGNU,eclipse(CDT)C,CompilersAutumn2002,7,RepresentationandManipulationInformation(1),C,8,Outline,BitandByteUnderstandmachinerepresentationsofnumbersSuggestedreading2.1.1,CompilersAutumn2002,9,WhyBit?,ModerncomputersstoreandprocessInformationrepresentedastwo-valuedsignalsTheselowlybinarydigitsarebitsBitsformthebasisofthedigitalrevolution,CompilersAutumn2002,10,TheDecimalRepresentation,Base-10Hasbeeninuseforover1000yearsDevelopedinIndiaImprovedbyArabmathematiciansinthe12thcenturyBroughttotheWestinthe13thcenturybytheItalianmathematicianLeonardoPisano,betterknownasFibonacci.,CompilersAutumn2002,11,WhyBit?,Usingdecimalnotationisnaturalforten-fingeredhumansButbinaryvaluesworkbetterwhenbuildingmachinesthatstoreandprocessinformation,CompilersAutumn2002,12,WhyBit?,Two-valuedsignalscanreadilyberepresented,stored,andtransmitted,ExamplesThepresenceorabsenceofaholeinapunchedcardAhighorlowvoltageonawireAmagneticdomainorientedclockwiseorcounterclockwise.,CompilersAutumn2002,13,WhyBit?,Theelectroniccircuitryisverysimpleandreliableforstoringandperformingcomputationsontwo-valuedsignalsThisenablingmanufacturerstointegratemillionsofsuchcircuitsonasinglesiliconchip,CompilersAutumn2002,14,GroupBits,Inisolation,asinglebitisnotveryusefulInEnglish,thereare26(or52)charactersinitsalphabet.TheyarenotusefuleitherinisolationHowever,thereareplentyofwordsinitsvocabulary.Howisthisachieved?Similarly,weareabletorepresenttheelementsofanyfinitesetbyusingbits(insteadofbit),CompilersAutumn2002,15,GroupBits,Todothis,wefirstgroupbitstogetherthenapplysomeinterpretationtothedifferentpossiblebitpatternsthatgivesmeaningtoeachpatterns8-bitchunksareorganizedasabyteDr.WernerBuchholzinJuly1956duringtheearlydesignphasefortheIBMStretchcomputer,CompilersAutumn2002,16,ValueofBits,Bits01010Value0*24+1*23+0*22+1*21+0*20=10Value102(1100110)Bits102=51*2+0(0)51=25*2+1(1)25=12*2+1(1)12=6*2+0(0)6=3*2+0(0)3=1*2+1(1)1=0*2+1(1),CompilersAutumn2002,17,GroupbitsasnumbersThreeencodings,UnsignedencodingRepresentingnumbersgreaterthanorequalto0UsingtraditionalbinaryrepresentationTwos-complementencodingMostcommonwaytorepresenteitherpositiveornegativenumbersFloatingpointencodingBase-twoversionofscientificnotationforrepresentingrealnumbers,CompilersAutumn2002,18,GroupbitsasnumbersUnderstandingnumbers,MachinerepresentationofnumbersarenotsameasIntegersandrealnumbersTheyarefiniteapproximationstointegersandrealnumbersSometimes,theycanbehaveinunexpectedway,CompilersAutumn2002,19,intisnotinteger,Overflow200*300*400*500=-884,901,888ProductofasetofpositivenumbersyieldedanegativeresultCommutativity,Fileinclusion,StandardLibrary,Headerfile,CompilersAutumn2002,29,FileInclusionandMacroSubstitution,MacroSubstitution,intj;main()return100+j;,CompilersAutumn2002,30,FileInclusionandMacroSubstitution,#include“filename”#include#defineforeverfor(;)/*infiniteloop*/#definesquare(x)(x)*(x),CompilersAutumn2002,31,FormattedOutput-Printf,intprintf(char*format,arg1,arg2,)printf(“%d,%dn”,i,j);%d,%idecimalnumber%ooctalnumber(withoutaleadingzero)%x,%Xhexadecimalnumber%csinglecharater,CompilersAutumn2002,32,IntegraldatatypeinC,ThereareseveraldatatypetorepresentintegersinCThedifferenceisthesizeoftheintegerItreflectstheimplementationofhardware,CompilersAutumn2002,33,TheContextofaCompiler(gcc),Sourceprogram(text),hello.c,CompilersAutumn2002,34,TheHelloProgram,SourceprogramCreatedbyeditorandsavedasatextfileBeginslifeasahigh-levelCprogramCanbereadandunderstandbyhumanbeingsTheindividualCstatementsmustbetranslatedbycompilerdriversSothatthehelloprogramcanrunonacomputersystem,CompilersAutumn2002,35,TheHelloProgram,TheCprogramsaretranslatedintoAsequenceoflow-levelmachine-languageinstructionsTheseinstructionsarethenpackagedinaformcalledanobjectprogramObjectprogramarestoredasabinarydiskfileAlsoreferredtoasexecutableobjectfiles,CompilersAutumn2002,36,Preprocessor,MacroSubstitution,Obtainwithcommandgcc-Ea.cSourcefilea.i,#1a.c#1#1#1a.c#1b.h1intj;#2a.c2main()return100+j;,CompilersAutumn2002,37,SourceCodeandAssemblyCode,Globalvariable,CompilersAutumn2002,38,MachineCode,CompilersAutumn2002,COMPILING,P,39,SourceCodes*.c,*.h,CProgramPreprocessor,SourceCodes*.i,CProgramCompiler,AssemblyCodes*.s,Assembler,Linker/Loader,GNUCompilerCollection,E,c,o,S,BinaryCodes*.out,BinaryCodes*.o,40,TheCProgrammingLanguage,Cwasdevelopedin1969to1973byDennisRitchieofBellLaboratories.TheAmericanNationalStandardsInstitute(ANSI)ratifiedtheANSICstandardin1989.ThestandarddefinestheClanguageandasetoflibraryfunctionsknownastheCstandardlibrary.,CompilersAutumn2002,41,TheCProgrammingLanguage,KernighanandRitchiedescribeANSICintheirclassicbookwhichisknownaffectionatelyas“K&R”.InRitchieswords,Cisquirky,flawed,andanenormoussuccess.Whythesuccess?,CompilersAutumn2002,42,TheCProgrammingLanguage,CwascloselytiedwiththeUnixoperatingsystemCwasdevelopedfromthebeginningasthesystemprogramminglanguageforUnix.MostoftheUnixkernel,andallofitssupportingtoolsandlibraries,werewritteninC.,CompilersAutumn2002,43,TheCProgrammingLanguage,CwascloselytiedwiththeUnixoperatingsystemAsUnixbecamepopularinuniversitiesinthelate1970sandearly1980s,manypeoplewereexposedtoCandfoundthattheylikedit.SinceUnixwaswrittenalmostentirelyinC,itcouldbeeasilyportedtonewmachines,whichcreatedanevenwideraudienceforbothCandUnix.,CompilersAutumn2002,44,TheCProgrammingLanguage,Cisasmall,simplelanguage.Thedesignwascontrolledbyasingleperson,ratherthanacommittee,andtheresultwasaclean,consistentdesignwithlittlebaggage.TheK&Rbookdescribesthecompletelanguageandstandardlibrary,withnumerousexamplesandexercises,inonly261pages.ThesimplicityofCmadeitrelativelyeasytolearnandtoporttodifferentcomputers.,CompilersAutumn2002,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 防汛应急抢险培训
- 天津仁爱学院《古代文学4》2023-2024学年第一学期期末试卷
- 2025建筑工程公司目标成本预算承包合同
- 景德镇艺术职业大学《多文体阅读(二)》2023-2024学年第二学期期末试卷
- 2025的企业劳动合同
- 2025商场宣传承包合同示范文本
- 济南护理职业学院《园林植物栽培学实践(二)》2023-2024学年第二学期期末试卷
- 南水北调大工程施工方案
- 逆做挡墙施工方案
- 2025年茶叶包装设计作品版权转让合同书
- 四川省内江市内江市第六中学2023-2024学年八年级下学期期中数学试题
- 抖音火花合同电子版获取教程
- 湖北省武汉市东湖高新区2023-2024学年五年级下学期期中英语试题
- 完整版带式输送机传动系统设计说明书(单级圆柱齿轮减速器+链传动)
- 第5课《弘扬劳动精神劳模精神工匠精神》第1框《理解劳动精神劳模精神工匠精神》-【中职专用】《职业道德与法治》同步课堂课件
- 《天文学上的旷世之争》 统编版高中语文选择性必修下册
- 山西省晋中市介休市2023-2024学年下学期期中测试七年级历史试卷
- JJG 365-2008电化学氧测定仪
- 期中模拟测试卷(试卷)-2023-2024学年一年级下册数学人教版
- 2024年青海省电力交易员竞赛选拔考试题库(含答案)
- (高清版)TDT 1067-2021 不动产登记数据整合建库技术规范
评论
0/150
提交评论