码迷,mamicode.com
首页 > 编程语言 > 详细

Notes on learning c++: chapter 0

时间:2018-01-21 22:39:17      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:res   sel   special   link   binary   recover   long   targe   for   

chapter 0

0.2    program(application or software): a set of instructions;

    machine code(machine language or instruction set): limited set of instructions that a CPU natively understand;

   1) instruction is composed of a number of binary digits(bit):MIPS architecture(32 bit long),x86(variable length);

   2) binary digits >>>CPU(instruction set)>>> instruction;

   3) example: 10110000 01100001;

   Assembly Language: each instruction is identified by a short name, variables can be identified by names rather than numbers;

   1) translated into machine language by using an assembler and fast;

   2) depend on CPU, require a lot of instructions to do simple task, hard to be read;

   3) example: mov al, 061h;

   High-level languages: write programs without having to be as concerned about what kind of computer the program is being run on;

   1) codes>>>compiler>>>executable program>>>CPU>>program results(C,C++,Pascal,java)

   2) codes>>>interpreter>>>CPU>> program results(Perl,javascipt,java)

   3) easier to read and write, require less instructions, don‘t concern yourself with details, portable to different architecture(except platform-specific functions)

   4) example: a = 97;

0.3   C and C++‘s philosophy: trust the programmer

0.4   Define the program to be solved>>>design a solution>>>write a program that implements the solution>>>compile the program>>>link object files>>>test and debug program

   Typically, good solutions have the followng characteristics:

   1) they are straightforward;

   2) they are well documented (especially any assumptions being made);

   3) they are built modularly, so parts can be reused or changed later without impacting otherparts of the program;

   4) they are robust, and can recover or give useful error messages when something unexpected happens.

   Typical editor:lining numbering, syntax highlighting and coloring, an unambiguous font.

   A single programs can have tens if not hundreds of individual .cpp files.

   The job of compiler  is twofold:

      1) to check your program and make sure it ollows the rules of the C++ language.

   2) to convent each file of source code into a machine language file called an object file.

   For complex projects, some development environment use a makefile, which is a file that tells the compiler which files to compile.

   Linker: taking all the object files generated by the compiler and combining them into a single executable program that you can run(runtime support), it also includes files from the C++ standard library(any other precompiled libraries).

   IDE(integrated development environment) bundles and integrated steps 3,4,5, and 6 together.

0.6   Project: stores the names of all the code files we want to compile, and also saves various IDE settings.

   A console project means that we are going to creat programs that can be run from the dos or linx command-line.

   A workspace or a solution is a container that can hold one or more realted projects.

0.6a A build configuration(build target) is a collection of project setting that determines how your IDE will build your project.(a release configuration and a debug configuration)

   The debug configuration is designed to help you debug your programs, turns off all the optimizations, and includes debugging information, which makes your programs larger and slower.

   The release configuration is designed to be used when releasing your program to the public. This version is typically optimized for size and performance, and doesn‘t contain the extra debugging information.

 

Notes on learning c++: chapter 0

标签:res   sel   special   link   binary   recover   long   targe   for   

原文地址:https://www.cnblogs.com/zimingzhu/p/8324833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!