




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 企业产业规划中的市场营销与产品推广策略
- 财富科技合同
- 保险科技产品创新合同
- 第十一课 怨天还是尤人教学设计初中心理健康北师大版2013七年级上册-北师大版2013
- 第16课 乘车出行说课稿-2025-2026学年小学地方、校本课程浙教版(2021)人·自然·社会
- 数字化时代下银行零售业务营销模式转型研究报告2025
- 2025年新能源行业绿色供应链管理实践与成效报告
- 环境应急预案简称
- 吴忠塑胶地板施工方案
- 单元复习与测试教学设计高中历史人教版2007必修2-人教版2007
- 【六年级上册语文】 必背重点成语及释义
- 人工智能导论-第2版-全套课件
- 《太赫兹时域光谱》课件
- 部编版六年级语文上册18《江南春》一等奖创新教学设计
- 2024-2025学年辽宁省沈阳市和平区南昌中学九年级(上)月考数学试卷(10月份)
- 第二单元 观察物体(单元测试)-2024-2025学年三年级上册数学北师大版
- 四川省挤塑聚苯板建筑保温工程技术规程
- 一例晚期直肠癌多发转移患者镇痛治疗病例分享
- 《工业互联网技术导论》 课件全套 第1-10章 智能制造与工业互联网-工业人工智能
- Ice-O-Matic CIM登峰系列制冰机培训手册
- 加油站应急情况处理技巧
评论
0/150
提交评论