已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025陕西博旺顾润生物科技有限公司招聘(11)模拟试卷附答案
- 2025西咸新区空港新城企业招聘(308人)笔试备考试题附答案
- 2026年一级注册建筑师之建筑物理与建筑设备考试题库300道及答案(易错题)
- 2026年一级注册建筑师之建筑结构考试题库300道附完整答案(全优)
- 2025 年高职文化市场经营管理(文化市场经营)试题及答案
- 2025 年高职网络系统管理(网络系统维护)试题及答案
- 2026年县直事业单位招聘公共基础知识真题200道及参考答案【b卷】
- 2026年初级管理会计之专业知识考试题库300道及参考答案(综合题)
- 2026年一级建造师之一建建筑工程实务考试题库500道含答案(预热题)
- 2026年一级建造师之一建市政公用工程实务考试题库500道含答案【考试直接用】
- 国家开放大学《儿童心理学》形考任务1-5参考答案
- 汽车新技术-发动机新技术
- 管道开挖回填基础工程量参考计算表
- 白杨礼赞 全国优质课一等奖
- 自动控制原理课程设计报告恒温箱
- 江西d照驾驶员理论考试
- GB/T 13298-2015金属显微组织检验方法
- 保洁人员工作手册
- 学校食堂满意度课件
- 商业中心项目质量标准化交流汇报56
- 手指末节肌腱止点重建课件
评论
0/150
提交评论