C ++ language FAQ solution: # 121 ~ # 140

xiaoxiao2021-03-06  29

This is the traditional translation of "C frequently asked Questions" found from Taiwan http://www.cis.nctu.edu.tw/chinese/doc/research/, found "C Frequently Asked Questions" Ye Bingzhe, is also a translator of "C Programming Language" 3 / e, this article is very good, paying it for learning purposes, I didn't get the author's authorization, the copyright of the original article still belongs to the original author .c FAQ Q121: "Genericity"? Another "class template" statement. Don't be confused with "Generality" (Generality, not too specific solution questions), "generic" refers to Class Template. ======================= ■ □ Section 20: Link Library ==================== ==== Q122: How to get "STL"? "STL" represents "Standard Templates Library", Standard Template Link Library. Take the law: STL HP Official Site:

ftp://butler.hpl.hp.com/stl

STL Code Alternate:

ftp://ftp.cs.rpi.edu/stl

STL Code EXAMPLES:

http://www.cs.rpi.edu/~musser/stl.html

STL Hacks for GCC-2.6.3 has been in GNU Libg 2.6.2.1 or updated (may be earlier versions). Thank you Mike Lindner. ======================================================= how program of? It is illegal to sell it, put it on the network is illegal. However, it only needs $ 30. ================================================= q124: Why is my executive file so big? ? Many people are surprised by such a large implementation, especially when the original code is only a little. For example, a simple "Hello World" program actually produces the size of everyone else to think (40 k bytes). One reason is: Some C execution link library is connected in. How much is connected, you have to see how much you used, and the compiler cuts the link library to how much. For example, iostream is large, including a large pile of categories and virtual functions, even if you only use a little bit, because the interactive reference dependency between components, the entire iostream program code may be plugged in. ([Translation] If Linker is done, you should cut off the completely used component Object Code, don't stuff into your executive file.) Don't use static, change the dynamic link library version, You can make your program smaller. For more information, please see your compiler manual or seek manufacturers' technical support. ================================ ■ □ Section 21: Detail of a specific system ================================================================================================================================================================================= ====================== q125: GNU C (G ) makes a big execution file, why? LIBG (G Link Library) may have unlocated information (-g) when compiling.

Some machines, do not recompile it with unambiguous information, which will save a large disk space (~ 1 MB; the disadvantage is: cannot be tracked to libg calls). Just "Strip" dropped the execution file, it is not more compiled with -g first, and "strip" will be valid. Use "size a.out" to see how big space is taken by the program and the data section of the execution code, instead of "ls -s a.out". This includes the symbol table. ============================================================================================================================================================================================================================================================ # Jim Roskind is a C YACC grammatist author, which is substantially compatible with the language in which the USL CFRONT 2.0 has been compatible (there is no Template, exception, and performing a periodic identification function). Some places and C have a small and subtle difference in this literary law. It can be obtained with Anonymous FTP to the following places: * iCS.UCI.edu (128.195.1) in "GNU / C grammar2.0.tar.z". * Mach1.npac.syr.edu (128.230.7.14) in "PUB / C / C grammar2.0.tar.z". ================================================================== ======= q127: What is C 1.2? 2.0? 2.1? 3.0? These are not "language" versions, but CFRONT is made by AT & T, the earliest C translation program number. The evolution of "Represents" C language is already recognized in this number. "Very" roughly, the main features are: * 2.0 contain multiple / virtual inheritance, and pure virtual functions. * 2.1 includes a semi-nested category, and "delete [] array pointer. * 3.0 includes a full-nested category, Template and "i " VS " i". * 4.0 will include exception processing.

================================================= q128: If the signature code is standardized, I can Do you connect the program code generated by the manufacturer compiler? A short answer: may not. In other words, some people want the standardized signature coding rule to incorporate the C ANSI standards in the addition, avoid buying different versions of the object link library for different vendors. However, in different systems, the difference between the signature coding is only a small part, even in the same basics. A part of the other differences here is listed here: 1) The number of arguments and types of the member function implies. 1A) 'this' Is there a special treatment? 1b) Where is the pointer of the value? 2) Assume that there is a VTABLE virtual form: 2A) Its content and configuration? 2b) When multiple inheritance, where is' / how to adjust? 3) How to configure the category, including: 3A) base category location? 3B) Processing of virtual basnel categories? 3C) The location of the virtual table pointer, if you use a virtual table? 4) Call conventions of functions, including: 4A) calvity or by the caller to adjust the stack? 4B) Where is the actual parameter? 4C) The order of actual parameters pass? 4D) How does the buffer store? 4E) Where is the transmission value? 4f) Is there a special provision for incoming / backback Struct or Double? 4G) Call end function (Leaf function) Is there a special buffer storage? 5) How is Run-Time-Type-IDENTIFICATION configuration? 6) When an exception is throw, how does the exception processing system know which area object be deconstructed? ======================================= ■ □ Section 22: Other technical and environment Matters ======================================= ● 22A: Other technical matters == ====================== q129: Why is the object category of Static data generates a Linker error? Static's data must except in the unique module.

^^^^^^ ~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The original article is: Static Data Members Must BeExplicitly Defined in Exactly One Module. Such as: Class Fred {public: //...private:static int i_; // Declaration Static Information Member "Fred :: i _" // ...} Linker will tell you "Fred :: i_ is not defined" unless you define "Fred :: i_" in any (and unique) in original file (not announced): int Fred :: i_ = Something generates an expression; or: int Fred :: i_; usually we will define the Static data member of the "Fred" category in the "fred" category, etc. You use it. Extension). ================================================== q130: "Struct" and "Class" key Where is the word difference? Struct members and base categories are preset to public, while Class is preset to private. Note: You should "clearly" set the base category as public, private, or protected instead of default. In addition, the functionality of both is equal. ============================================================================================================================================================================================================================= Come multi (overload it? If you announce the "char f ()" and "float f ()", the compiler will give you an error message because the call "F ()" will cause simulation. ================================================= q132: What is "continuity"? What is "sustainable object"? A persistent object, can still survive after the execution of its program is created. It can even survive in different parent programs, survive on disk systems, operating systems, or even hardware where the operating system is located.

Difficulties in persistent objects are: How to effectively store their operating behavior (Method) and data bits (and all member objects, and all members objects, base categories ... Wait). All this has to do it yourself, but it is not easy. In C , you have to come. The C / OO database system will hide these mechanisms for you. ======================================================= q133: Why floating point (floating point) Isn't it accurate? Why is this program not printed with 0.43? #include main () {float a = 1000.43; float a = 1000.0; cout << a - b << '/ n';} (notes) The bust of the carry / place / approximation is not the problem of C , but the problem of computer science. But still have a question in comp.lang.c , so I will give you a answer. Answer: The floating point is originally an approximation. In the 32-bit floating point standard in IEEE, there is a 1 bit of positive or 8-bit index, 23-bit false number. Because the normalized binary fake number will become a typographic shape like a 1.xxxxx ..., the 1 1st 1 will not be included, you can get a 24-bit effective false number. 1000.43 (lot numbers and other) are not float or double representation, in fact, is such digital content 1000.43 promoter ( 's' representative of the sign, 'e' Representative index, 'm' representative of the number of false): seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm01000100011110100001101110000101 The fake number is changed to 1111101000.01101110000101 or 1000 7045/16384. The fraction part is 0.429992675781. Float's fake number accounts for 24, so you only get one of 16m in the accuracy. Double has a high degree of accuracy (53-bit fake).

========================== ● 22B: trivial matters in other environments ========================================================================================================================================================================== ========== Q134: Is there any TEX or LATEX macro that can handle the white effect of "C "? Yes, there are two: / def / cc {c / raise.22ex / hbox {{/ footnotesize }} / raise.22ex / hbox {/ footNotesize }} / DEF / CC {C / Hspace { -.05em} / raisebox {.4ex} {/ tiny / bf }}}} ============================== ========== Q135: Where can I get the C 2Latex this C original code LATTTYPRINTER? This lists some FTP locations: host aix370.rz.uni-koeln.de (134.95.80.1) Last Updated 15:41 26 Apr 1991Location: / tex file rw-rw-r - 59855 May 5 1990 C 2latex- 1.2.tar.zhost utsun.su-tokyo.ac.jp (133.11.11.11) Last Updated 05:06 20 Apr 1991Location: / TEX / MacrosFile RW-R - R - 59855 Mar 4 08:16 C 2latex -1.1.tar.zhost Nuri.inria.fr (128.93.1.26) Last Updated 05:23 9 Apr 1991Location: / TEX / Toolsfile RW-RW-R - 59855 OCT 23 16:05 C 2latex-1.1.tar .Zhost Iamsun.unibe.ch (130.92.64.10) Last Updated 05:06 4 Apr 1991Location: / TexFile RW-R - R - 59855 APR 25 1990 C 2latex-1.1.tar.zhost Iamsun.Unibe.ch (130.92.64.10) Last Updated 05:06 4 APR 1991Location: / TexFile RW-R - R - 51737 APR 30 1990C

2 de (192.35.229.9) Last Updated 05:07 18 APR 1991Location: / Pub / TextProc / TexFile RW-R - ROC / TEXFILE RW-R - R - 72957 OCT 25 13:51 C 2latex-1.1-pl4.tar.zhost wuarchive.wustl.edu (128.252.135.4) Last Updated 23:25 30 Apr 1991Location: /Packages/tex/tex/192.35.229.9/textproc/texfile rw -rw-r - 49104 APR 10 1990 C 2latex-pl2.tar.zfile RW-RW-R - 25835 APR 10 1990 C 2latex.tar.zhost tupac-amaru.informatik.rwth-aachen.de (192.35.229.9) Last Updated 05:07 18 APR 1991Location: / Pub / TextProc / Texfile RW-R - R - 74015 Mar 22 16:23 C 2LATEX-1.1-Pl5.tar.zlocation: / Pub File RW-R - R - 74015 Mar 22 16:23 C 2LateX-1.1-Pl5.tar.zhost Sol.cs.ruu.nl (131.211.80.5) Last Updated 05:10 15 Apr 1991Location: / TEX / Toolsfile RW-R - R - 74015 APR 4 21: 02x ​​C 2latex-1.1-pl5.tar.zhost tupac-amaru.informatik.rwth-aachen.de (192.35.229.9) Last Updated 05:07 18 APR 1991Location: / Pub / TextProc / TexFile RW-R - R - 4792 SEP 11 1990 C 2Latex-1.1-Patch # 1File RW-R - R - 2385 Sep 11 1 990 C 2Latex-1.1-Patch # 2File RW-R - R - 5069 SEP 11 1990 C 2Latex-1.1-Patch # 3File RW-R - R - 1587 OCT 25 13:58 C 2latex-1.1-patch # 4file rw-r - r - 8869 Mar 22 16:23 C 2latex-1.1-Patch # 5File RW-R - R - 1869 Mar 22 16:23 C 2latex. ReadmeHost Rusmv1.rus.uni-Stuttgart.de (129.69.1.1) Last Updated 05:13 13 Apr 1991Location: / Soft / TEX / UTILITIESFILE RW-RW-R - 163840 JUL 16 1990 C 2latex-1.1.tar = =====================================================================================================================================================================

C / ETC original code beauty tool? "TGRIND" reads the C source file and outputs things that can make UNIX printers print a beautiful file. It often accompanied by TEX and LATEX kits; please find this directory: "... tex82 / contrib / van / tgrind". Updated by Jerry Leichter, can be found in venus.ycc.yale.edu in [.tgrind]. ============================================================================================================================================================================================================= -mode? If you have, how do you take it? YES, there is a C - Mode for GNU Emacs. The latest, best C - Mode (and C-Mode) version is CC-MODE.EL file, which is the extension of the Detlef & Clamen version. There is one in the Emacs, which is new in Elisp. ======================================================== q138: Where I want to get and the operating system Related FAQs (such as BC , DOS, Windows, etc.)? Please refer to: * Comp.os.msdos.programmer * Comp.Windows.ms.programmer * Comp.unix.Programmer [If you have BC , VC Email Address, or Semantic C bug list or Mailing List for discussion Please tell me how to join, I will be put forward here. ] =========================================================== Why is my DOS C program? "Sorry: floating points not linked" "Sorry, the floating point calculation program code is not connected"? The compiler will try to save the size of the file, so unless it is necessary, it will not introduce the floating point number → string format conversion subroutine, but sometimes it will guess, and the above error message will be generated.

转载请注明原文地址:https://www.9cbs.com/read-83342.html

New Post(0)