home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 8.img / DOC.ZIP / HELPME!.DOC next >
Encoding:
Text File  |  1990-05-04  |  27.0 KB  |  659 lines

  1.               TURBO C++: ANSWERS TO COMMON QUESTIONS
  2.  
  3.  
  4.  G e t t i n g     S t a r t e d
  5.  ----------------------------------------------------------------------
  6.  Q. How do I install Turbo C++?
  7.  A. Run the INSTALL program from the INSTALL/HELP disk. To start
  8.     the installation, change your current drive to the one that
  9.     has the install program on it and type INSTALL. You will be
  10.     given instructions in a box at the bottom of the screen for
  11.     each prompt. For example, if you will be installing from
  12.     drive A:, type:
  13.  
  14.        A:
  15.        INSTALL
  16.  
  17.     At this point, the INSTALL program will appear with menus
  18.     selections and descriptions to guide you through the installation
  19.     process.
  20.  
  21.  Q. How do I run Turbo C++?
  22.  A. After you have installed Turbo C++, type "TC" from the DOS
  23.     prompt and you're ready to go.
  24.  
  25.  Q. What is the difference between TC.EXE and TCC.EXE?
  26.  A. The Turbo C++ package comes with two compilers, an Integrated
  27.     Environment named TC.EXE and a command-line compiler named
  28.     TCC.EXE. The Integrated Environment combines the command-line
  29.     compiler with an integrated editor, linker, debugger, and other
  30.     useful features (such as pop-up and pull-down menus, full keywobard
  31.     and mouse support, and so on). The command-line version runs from
  32.     the DOS command line. Please refer to the Turbo C++ User's Guide
  33.     for details on using both systems.
  34.  
  35.  Q. What is a configuration file?
  36.  A. A configuration file tells Turbo C++ what options to default to
  37.     and where to look for its library and header files. TC.EXE
  38.     looks for a configuration file named TCCONFIG.TC, and TCC.EXE
  39.     looks for a file named TURBOC.CFG.
  40.  
  41.  Q. How do I create a configuration file?
  42.  A. When you run the INSTALL program it creates a configuration
  43.     file named TURBOC.CFG for TCC.EXE. This file is just an
  44.     ASCII file which you can change with any text editor. It
  45.     contains the path information for the library and header
  46.     files for TCC.EXE to use. The INSTALL program does not
  47.     create a TCCONFIG.TC file for TC.EXE because it installs
  48.     the directory information directly into TC.EXE. You can
  49.     create a configuration file for TC.EXE by running Turbo C++,
  50.     setting your options however you want to set them, and
  51.     typing Alt-O/S.
  52.  
  53.  
  54.  I n t e g r a t e d    E n v i r o n m e n t
  55.  ----------------------------------------------------------------------
  56.  Q. Why is Turbo C++ not able to find any of my #include files?
  57.  A. The compiler searches for include files in the Turbo C++ Include
  58.     Directories path. You can specify this path through the
  59.     Options|Directories menu. The INSTALL program initially sets this
  60.     path to the directory where it copied all the Turbo C++ *.h files.
  61.  
  62.  Q. Why do I get the message:
  63.     Linker Error: Unable to open input file 'C0x.OBJ'
  64.  A. The linker searches for Turbo C++ start-up and library files in the
  65.     Turbo C++ Library Directories path. You can specify this path through
  66.     the Options|Directories menu. The INSTALL program initially sets this
  67.     path to the directory where it copied the start-up and library files.
  68.  
  69.  Q. How do I get Turbo C++ to link in my own libraries or use multiple
  70.     source files?
  71.  A. Turbo C++'s Project facility is designed to allow you to work with
  72.     multiple files.
  73.  
  74.  Q. Why does the linker tell me that all the graphics library routines
  75.     are undefined?
  76.  A. The Options|Linker|Graphics Library item must be set ON, if
  77.     you are using any Turbo C++ graphics functions and have not
  78.     specifyed GRAPHICS.LIB in a project file.
  79.  
  80.  Q. Why does Turbo C++ report "Unable to open include file 'stdarg.h'"
  81.     when I try to #include <stdio.h>?
  82.  A. The most probable reason is that you have exceeded the number
  83.     of files that DOS can have open simultaneously. Add the line
  84.  
  85.        FILES=20
  86.  
  87.     to your DOS CONFIG.SYS file. This allows DOS to open up to 20
  88.     files at the same time. CONFIG.SYS will only be effective after
  89.     you have rebooted your computer. See the IBM DOS Reference
  90.     Manual for details on the CONFIG.SYS file.
  91.  
  92.  Q. How do I change the colors of the editor and menus in TC?
  93.  A. The utility TCINST.EXE allows you to customize your colors.
  94.  
  95.  Q. How do I get a listing of my source code to my printer?
  96.  A. From within the Turbo C++ editor press Ctrl-K-P. This will
  97.     print a marked block to the printer. If no block is marked,
  98.     this key sequence will print the entire file in your editor.
  99.  
  100.  Q. When I Make, Run, or Trace a program, Turbo C++ sometimes goes
  101.     through the compile and link process even when the object files
  102.     are up-to-date.
  103.  A. Turbo C++'s MAKE logic works solely on a file's date and time
  104.     stamp. If one of your source files is marked with a date
  105.     that's sometime in the future, the object files that are
  106.     created from it will always be older than the source file,
  107.     and Turbo C++ will always try to rebuild the file. You can fix
  108.     this by using TOUCH.COM to set the file to the current date
  109.     and time. You should also make sure that your system's date
  110.     and time are always properly set. TOUCH.COM is documented in
  111.     the file UTIL.DOC.
  112.  
  113.  Q. How come my old Turbo C++ project files don't work anymore?
  114.  A. Project files now contain much more information about a project now,
  115.     and hence are no longer stored in ASCII format. To create a project
  116.     file, select PROJECT from the main menu, and follow the menus. To
  117.     convert your old project files to the new format, use the supplied
  118.     utility file PRJCNVT.EXE (documented in UTIL.DOC).
  119.  
  120.  Q. How can I convert my Turbo C 2.0 project files to the new
  121.     format?
  122.  A. There is a conversion utility in your Turbo C++ BIN directory
  123.     called PRJCNVT.EXE. This program will perform the conversion.
  124.  
  125.  Q. How come my project file is automatically loaded when I start TC. I
  126.     want to work on a different program.
  127.  A. If there is only one project file in the current directory, Turbo C++
  128.     will load and use that one file. If there are no project files, or
  129.     if there are multiple project files, Turbo C++ does not automatically
  130.     load one.
  131.  
  132.  Q. My right mouse button appears to do nothing. Can I change this so it
  133.     will set breakpoints?
  134.  A. Yes, under the menu for Options|Environment|Mouse there is a
  135.     dialog box for the right mouse button. You can change it to set
  136.     breakpoints, or to do many other things.
  137.  
  138.  Q. How do I get Turbo C++ to use extended or expanded memory?
  139.  A. Use the /X switch for extended and the /E switch for expanded when
  140.     you invoke Turbo C++.
  141.  
  142.  Q. How can I find out where my "null pointer assignment" is occurring?
  143.  A. Set a watch on the following expressions:
  144.  
  145.             *(char *)0,4m
  146.             (char *)4
  147.  
  148.     Step through the program. When the values change, the just-executed line
  149.     is the one that is causing the problem.
  150.  
  151.  Q. When I compile my program, I get the following error:
  152.  
  153.     Error: C:\TC\INCLUDE\STDIO.H: Overlays only supported in
  154.     medium, large, and huge memory models
  155.  
  156.     What is happening?
  157.  A. The Overlay Support option has been selected and does not work
  158.     in the tiny, small, or medium memory models.
  159.  
  160.     You may turn this option off with:
  161.     Options|Compiler|Code Generation|Overlay Support
  162.    
  163.  Q. When I try to load a new file after editing a file, the first
  164.     file remains on the screen. How do I close the first file?
  165.  A. Use Alt-F3 to close the current file. Also, use F6 to move
  166.     from one file to the next, if there is more than one file
  167.     open at a time.
  168.  
  169.  Q. I'm doing a search and replace operation, and the editor prompts me for
  170.     each replacement. I've selected "Change All", but it still does it.
  171.  A. To disable the prompting, you must unselect the "Prompt on replace"
  172.     option on the left side of the dialog box.
  173.  
  174.  Q. When I try to use the any of the pseudo registers, like _AX, I
  175.     get the error message "Undefined symbol '_AX' in function..."
  176.     when I compile. Why?
  177.  A. You are only allowed to use the pseudo registers in the Turbo
  178.     C++ and ANSI modes of the compiler. You can change this setting
  179.     in the Options|Compiler|Source menu.
  180.  
  181.  Q. Since I don't have a mouse, can I still copy blocks of code
  182.     from one file to another?
  183.  A. Yes. You can mark the beginning and end of a block by moving
  184.     to the appropriate area and pressing Ctrl-K-B (mark beginning) and
  185.     Ctrl-K-K (mark end). You can then use the copy and paste commands
  186.     in the Edit menu.
  187.  
  188.  
  189.  C o m m a n d  -  L i n e    C o m p i l e r
  190.  ----------------------------------------------------------------------
  191.  Q. Why is Turbo C++ not able to find any of my #include files?
  192.  A. The compiler searches for include files in the Turbo C++ Include
  193.     Directories path. You specify this path with the -I switch. The INSTALL
  194.     program initially writes a configuration file (TURBOC.CFG) that
  195.     sets this path to the directory where it copied all the Turbo C++
  196.     *.h files.
  197.  
  198.  Q. Why do I get the message:
  199.     Linker Error: Unable to open input file 'C0x.OBJ'
  200.  A. The linker searches for Turbo C++ start-up and library files in the
  201.     Turbo C++ Library Directories path. You can specify this path with
  202.     the -L switch. If you allow TCC to invoke the linker, it will search
  203.     the directories in the configuration file (TURBOC.CFG) written by the
  204.     INSTALL program. If you run TLINK, the configuration file is not read.
  205.  
  206.  Q. Why does the linker tell me that all the graphics library
  207.     routines are undefined?
  208.  A. TCC will not search the graphics library unless you tell it to.
  209.     You should specify the graphics library on the command line. For
  210.     example, to compile BGIDEMO, type
  211.  
  212.        TCC BGIDEMO.C GRAPHICS.LIB<Enter>
  213.  
  214.  
  215.  G e n e r a l     I / O
  216.  ----------------------------------------------------------------------
  217.  Q. The '\n' in cprintf() does not return the cursor to the
  218.     beginning of the line. It only moves the cursor down one line.
  219.  A. cprintf() interprets '\n' as a Line Feed. To force the cursor to
  220.     the beginning of the line, manually insert a Carriage Return:
  221.  
  222.       cprintf("\n\r");
  223.  
  224.  Q. How do I print to the printer from a Turbo C++ program?
  225.  A. Turbo C++ uses a FILE pointer (stdprn) defined in the STDIO.H
  226.     file. You do not need to open stdprn before using it:
  227.  
  228.        #include <stdio.h>
  229.        int main(void)
  230.        {
  231.            fprintf(stdprn, "Hello, world\n");
  232.        }
  233.  
  234.     Note that if your printer is line-buffered, the output is
  235.     flushed only after a '\n' is sent.
  236.  
  237.  Q. I am reading and writing binary files. My program is translating
  238.     the Carriage Return (0x0D) and Line Feed (0x0A) characters. How do
  239.     I prevent this from happening?
  240.  A. Files opened in text mode will translate these characters for
  241.     DOS. To read a file in binary mode, open it in binary mode.
  242.     For example,
  243. ,
  244.       #include <stdio.h>
  245.       int main(void)
  246.       {
  247.          FILE *binary_fp;
  248.          char buffer[100];
  249.  
  250.          binary_fp = fopen("MYFILE.BIN", "rb");
  251.  
  252.          fread(buffer, sizeof(char), 100, binary_fp);
  253.  
  254.                     :
  255.       }
  256.  
  257.     The default file mode is text.
  258.  
  259.  Q. Why don't printf() and puts() print text in color?
  260.  A. Use the console I/O functions cprintf() and cputs() for color output.
  261.  
  262.       #include <conio.h>
  263.       int main(void)
  264.       {
  265.           textcolor(BLUE);
  266.           cprintf("I'm blue.");
  267.       }
  268.  
  269.  Q. How do I print a long integer?
  270.  A. Use the "%ld" format:
  271.  
  272.       long int l = 70000L;
  273.       printf("%ld", l);
  274.  
  275.  Q. How do I print a long double?
  276.  A. Use the "%Lf" format.
  277.  
  278.       long double ldbl = 1E500;
  279.       printf("%Lf", ldbl);
  280.  
  281.  
  282.  E x a m p l e   P r o g r a m s
  283.  ----------------------------------------------------------------------
  284.  Q. How do I compile the BGIDEMO program?
  285.  A. 1. Make sure that the following Turbo C++ files are in your
  286.        current directory:
  287.  
  288.          BGIDEMO.C
  289.          *.BGI
  290.          *.CHR
  291.  
  292.     2. Run Turbo C++.
  293.  
  294.     3. Load BGIDEMO.C into the Editor by pressing F3, then typing
  295.        BGIDEMO<Enter>
  296.  
  297.     3. Go to the Run menu and choose the Run item.
  298.  
  299.  Q. How do I create a COM file?
  300.  A. DOS versions 3.2 and earlier include an EXE2BIN utility that
  301.     converts EXE files to COM files. Users who do not have EXE2BIN can
  302.     use TLINK, the Turbo C++ command-line linker, to create a COM file
  303.     instead of an EXE file. Use the /t option. For example:
  304.  
  305.        tcc -mt -lt tiny
  306.  
  307.     will create TINY.COM instead of TINY.EXE.
  308.  
  309.     There are certain limitations in converting an EXE file to a COM
  310.     file. These limitations are documented in the IBM Disk Operating
  311.     System manual under EXE2BIN.
  312.  
  313.     Turbo C++'s TINY model is compatible with the COM format, but programs
  314.     that use Turbo C++'s floating-point routines cannot be converted to a
  315.     COM file.
  316.  
  317.  
  318.  G r a p h i c s
  319.  ----------------------------------------------------------------------
  320.  Q. Why do I get the error message:
  321.  
  322.        BGI Error: graphics not initialized (use 'initgraph')
  323.  
  324.     when I use a graphics function? My program has already
  325.     called initgraph().
  326.  A. For some reason initgraph() failed. To find out why, check
  327.     the return value of graphresult(). For example:
  328.  
  329.       #include <graphics.h>
  330.       int main(void)
  331.       {
  332.         int gerr;   /* graphics error */
  333.         int gdriver = DETECT, gmode;
  334.  
  335.         /* Initialize graphics using auto-detection and look
  336.            for the .BGI and .CHR files in the C:\TURBOC directory.
  337.         */
  338.         initgraph(&gdriver, &gmode, "C:\\TURBOC");
  339.  
  340.         if ((gerr = graphresult()) != grOk)
  341.         {
  342.             printf("Error : %s\n", grapherrormsg(gerr));
  343.             exit(1);
  344.         }
  345.                :
  346.       }
  347.  
  348.  
  349.  M a t h  /  F l o a t i n g    P o i n t
  350.  ----------------------------------------------------------------------
  351.  Q. Why do I get incorrect results from all the math library
  352.     functions like cos(), tan() and atof()?
  353.  A. You must #include <math.h> before you call any of the standard
  354.     Turbo C++ math functions. In general, Turbo C++ assumes that a function
  355.     that is not declared returns an int. In the case of math functions,
  356.     they usually return a double. For example
  357.  
  358.         /* WRONG */                       /* RIGHT */
  359.                                           #include <math.h>
  360.         int main(void)                    int main(void)
  361.         {                                 {
  362.           printf("%f", cos(0));             printf("%f", cos(0));
  363.         }                                 }
  364.  
  365.  Q. How do I "trap" a floating-point error?
  366.  A. See the signal() and matherr() functions in the Turbo C++ Library
  367.     Reference. The signal() function may be used to trap errors in the
  368.     80x87 or the 80x87 emulator. The matherr() function traps errors
  369.     in the Math Library functions.
  370.  
  371.  
  372.  L i n k e r    E r r o r s
  373.  ----------------------------------------------------------------------
  374.  Q. Why do I get the message:
  375.       Linker Error: Unable to open input file 'C0x.OBJ'
  376.  A. See "Integrated Environment" section above.
  377.  
  378.  Q. Why do I get the message:
  379.       Linker Error: Undefined symbol '_main' in module C0
  380.  A. Every C program must contain a function called main(). This
  381.     is the first function executed in your program. The function
  382.     name must be all in lower case. If your program does not
  383.     have one, create one. If you are using multiple source files,
  384.     the file that contains the function main() must be one of
  385.     the files listed in the Project.
  386.  
  387.     Note that an underscore character '_' is prepended to all
  388.     external Turbo C++ symbols.
  389.  
  390.  Q. Why does the linker tell me that all the graphics library
  391.     routines are undefined?
  392.  A. See the "Integrated Environment" and "Command-line Compiler"
  393.     sections above.
  394.  
  395.  Q. What is a 'Fixup overflow'?
  396.  A. See the listing of TLINK error messages in the Turbo C++
  397.     User's Guide.
  398.  
  399.  Q. I am linking my own assembly language functions with Turbo C++.
  400.     The linker reports that all of my functions are undefined.
  401.  A. Make sure that you have put an underbar character '_' in front of all
  402.     assembly language function names to be called by Turbo C++. Your assembly
  403.     language program should be assembled with Case Sensitivity.
  404.  
  405.  
  406.  O t h e r    Q u e s t i o n s
  407.  ----------------------------------------------------------------------
  408.  Q. How do I change the stack size?
  409.  A. The size of the stack of a Turbo C++ program is determined at
  410.     run time by the global variable _stklen. To change the size
  411.     to, for example, 10,000 bytes, include the following line in
  412.     your program:
  413.  
  414.       extern unsigned _stklen = 10000;
  415.  
  416.     This statement must not be inside any function definition.
  417.     The default stack size is 4,096 bytes (4K).
  418.  
  419.  Q. I'm getting a 'Stack Overflow!' message when I run my program.
  420.     How can I work around this?
  421.  A. You may increase the stack size by following the procedure above. Stack
  422.     overflows are usually caused by a large amount of local data or
  423.     recursive functions. You can decrease the amount of stack space
  424.     used by declaring your local variables static:
  425.  
  426.          int main(void)                int main(void)
  427.          {                             {
  428.              char x[5000];     -->          static char x[5000];
  429.                  :                                :
  430.          }                             }
  431.  
  432.     Of course, you should be aware that there are other effects
  433.     that the "static" keyword has, as applied here. See the Turbo C++
  434.     Programmer's Guide.
  435.  
  436.  Q. My program comes up with the message 'Null pointer assignment'
  437.     after it terminates. What does this mean?
  438.  A. Before a small-data model Turbo C++ program returns to DOS, it will
  439.     check to see if the beginning of its data segment has been corrupted.
  440.     This message is to warn you that you have used uninitialized pointers
  441.     or that your program has corrupted memory in some other way.
  442.  
  443.  Q. Why are .EXE files generated by TC.EXE larger than those
  444.     generated by TCC.EXE?
  445.  A. In the default configuration, TC.EXE includes debugging
  446.     information in the .EXE files that it creates, and TCC.EXE
  447.     does not. If you don't want to produce this debugging
  448.     information, you can shut it off in the Integrated
  449.     Development Environment by selecting Alt-D|S|N.
  450.  
  451.  Q. Why do I get "declaration syntax error" messages on DOS.H?
  452.  A. You have set the "Ansi keywords only" option ON. Keep this option
  453.     OFF when using any keywords specific to Turbo C++. See the Turbo C++
  454.     Programmer's Guide for a list of keywords.
  455.  
  456.  Q. I have a working program that dynamically allocates memory
  457.     using malloc() or calloc() in small data models (tiny, small,
  458.     and medium). When I compile this program in large data models
  459.     (compact, large, and huge), my program hangs.
  460.  A. Make sure that you have #include <alloc.h> in your program.
  461.  
  462.  Q. I am linking my own assembly language functions with Turbo C++.
  463.     But the linker reports that all of my functions are undefined.
  464.  A. See answer above in the "Linker" section.
  465.  
  466.  Q. My far pointers "wrap around" when they are incremented over 64K.
  467.     How do I reference a data object that is greater than 64K?
  468.  A. Use huge pointers.
  469.  
  470.  Q. How do I interface Turbo C++ routines to a Turbo Pascal program?
  471.  A. See the example programs CPASDEMO.PAS and CPASDEMO.C on disk.
  472.     These files are packed in the file EXAMPLES.ARC. You will
  473.     need to UNPACK them before using them.
  474.  
  475.  Q. How do I get Clipper to link with Turbo C++?
  476.  A. If you are having trouble, contact Nantucket Technical Support.
  477.  
  478.  
  479.  C o m m o n   C + +   Q u e s t i o n s
  480.  ----------------------------------------------------------
  481.  
  482.  Q. What potential problems can arise from typecasting a base
  483.     class pointer into a derived class pointer so that the derived
  484.     class's member functions can be called?
  485.  A. Syntactically this is allowable. There is always a possibility of
  486.     a base pointer actually pointing to a base class. If this is
  487.     typecast to a derived type, the method being called may not exist
  488.     in the base class. Therefore, you would be grabbing the address of
  489.     a function that does not exist.
  490.  
  491.  Q: What's the difference between the keywords STRUCT and CLASS?
  492.  A: The members of a STRUCT are PUBLIC by default, while in CLASS,
  493.     they default to PRIVATE. They are otherwise functionally equivalent.
  494.  
  495.  Q: I have declared a derived class from a base class, but I can't access any
  496.     of the base class members with the derived class function.
  497.  A: Derived classes DO NOT get access to private members of a base class.
  498.     In order to access members of a base class, the base class members must
  499.     be declared as either public or protected. If they are public, then
  500.     any portion of the program can access them. If they are protected, they
  501.     are accessible by the class members, friends, and any derived classes.
  502.  
  503.  Q: How can I use the Paradox Engine with C++?,
  504.  A: Because the Paradox Engine functions are all compiled as C functions
  505.     you will have to assure that the names of the functions do not get
  506.     "mangled" by the C++ compiler. To do this you need to prototype the
  507.     Engine functions as extern "C". In the pxengine.h header file insert
  508.     the following code at the lines indicated.
  509.  
  510.        /* inserted at line # 268 */
  511.        #ifdef __cplusplus
  512.        extern "C" {
  513.        #endif
  514.  
  515.        /* inserted at line # 732, just before the final #endif */
  516.        #ifdef __cplusplus
  517.        }
  518.        #endif
  519.  
  520.  Q: I have a class that is derived from three base classes. Can I insure that
  521.     one base class constructor will be called before all other constructors?
  522.  A: If you declare the base class as a virtual base class, its constructor
  523.     will be called before any non-virtual base class constructors. Otherwise
  524.     the constructors are called in left-to-right order on the declaration
  525.     line for the class.
  526.    
  527.  Q: Are the standard library I/O functions still available for use with
  528.     the C++ iostreams library?
  529.  A: Yes, using
  530.  
  531.        #include <stdio.h>
  532.  
  533.     functions such as printf() and scanf() will continue to be
  534.     available.
  535.  
  536.  Q: When debugging my program in Turbo Debugger, I notice that none of my
  537.     inline functions are expanded inline. Instead, they are all done as
  538.     function calls.
  539.  A: Whenever you compile your program with debugging information included,
  540.     no functions are expanded inline. To verify that your inline functions
  541.     are indeed expanding inline, compile a module with the -S flag of the
  542.     command-line compiler, then examine the .asm file that is generated.
  543.  
  544.  Q. In C++, given two variables of the same name, one local and one global,
  545.     how do I access the global instance within the local scope?
  546.  A. Use the scope (::) operator.
  547.  
  548.        int x = 10;
  549.        for(int x=0; x < ::x; x++)
  550.        {
  551.            cout << "Loop # " << x << "\n"; // This will loop 10 times
  552.        }
  553.  
  554.  Q. Will the following two functions be overloaded by the compiler, or
  555.     will the compiler flag it as an error? Why?
  556.         void test( int x, double y);  &  int test( int a, double b);
  557.  A. The compiler will flag this as a redeclaration error because
  558.     neither return types nor argument names are considered when determining
  559.     unique signatures for overloading functions. Only number and type
  560.     of arguments are considered.
  561.  
  562.  Q. If I pass a character to a function which only only accepts an int,
  563.     what will the compiler do? Will it flag it as an error?
  564.  A. No. The compiler will promote the char to an int and use the integer
  565.     representation in the function instead of the character itself.
  566.  
  567.  Q. I was trying to allocate an array of function pointers using the new
  568.     operator but I keep getting declaration syntax errors using the following
  569.     syntax:  new int(*[10])();   What's wrong?
  570.  A. The new operator is a unary operator and binds first to the int keyword
  571.     producing the following:  (new int) (*[10])();
  572.     You need to put parentheses around the expression to produce the
  573.     expected results:  new (int (*[10]());
  574.  
  575.  Q. What are inline functions? What are their advantages? How are they
  576.     declared?
  577.  A. An inline function is a function which gets textually inserted by
  578.     the compiler, much like macros. The advantage is that execution time
  579.     is shortened because linker overhead is minimized. They are declared
  580.     by using the inline keyword when the function is declared:
  581.     inline void func(void) { cout << "printing inline function \n"; }
  582.     or by including the function declaration and code body within a class:
  583.  
  584.        class test
  585.        {
  586.        public:
  587.        void func(void) { cout << "inline function within a class.\n"}
  588.        };
  589.  
  590.  Q. If I don't specify either public or private sections in a class,
  591.     what is the default?
  592.  A. A class will default all members to private if neither public nor
  593.     private sections are declared.
  594.  
  595.  Q. What does the _seg modifier do?
  596.  A. Using _seg cause a pointer to become a storage place for a
  597.     segment value, rather than an offset ( or a segment/offset ).
  598.     For instance, if "int _seg *x" contains the value 0x40,
  599.     then when you use "*x", the value pointed to will be at
  600.     segment 0x40, offset 0. If you add a value to the pointer,
  601.     the value is multiplied by the size of the pointer type. That
  602.     new value is used as an offset, and is combined with the segment
  603.     value contained in the pointer. For instance,
  604.  
  605.        int _seg *x;
  606.        int value;
  607.  
  608.        x = (int _seg *)0x40;
  609.        value = *(x + 20);
  610.  
  611.     value is assigned the value of the integer at 0x40:0x28
  612.     (Remember, 20 * sizeof(int) = 40 = 0x28).
  613.  
  614.  Q. Can I statically allocate more than 64K of data in a single module?
  615.  A. Yes. Far data items are now supported:
  616.  
  617.        ...
  618.        char far array1[60000L];
  619.        char far array2[60000L];
  620.        ...
  621.  
  622.     For arrays larger than 64k use:
  623.  
  624.        char huge array3[100000L];
  625.  
  626.  
  627.  Q. Why do I get a "Type name expected" error on my definition of a
  628.     friend class in my new class?
  629.  A  You need to let the compiler know that the label you use for your
  630.     friend class is another class. If you do not want to define your
  631.     entire class, you can simply have "class xxx", where xxx is your
  632.     label.
  633.  
  634.  Q: How can I output hex values in upper case using the iostream libraries?
  635.  A: You need to set the state of the stream using setf(). For example,
  636.  
  637.        #include <iostream.h>
  638.  
  639.        int main(void)
  640.        {
  641.           cout << hex;
  642.           cout << "\nNot upper-case : " << 255;
  643.           cout.setf(ios::upper-case);
  644.           cout << "\nUppercase     : " << 255;
  645.           return 0;
  646.         }
  647.  
  648.  Q. What is the "this" pointer?
  649.  A. "this" is a local variable in the body of a non-static member function.
  650.     It is a pointer to the object for which the function was invoked. It
  651.     cannot be used outside of a class member function body.
  652.  
  653.  Q. Why does a binary member function only accept a single argument?
  654.  A. The first argument is defined implicitly.
  655.  
  656.  Q. What is a friend member function?
  657.  A. Declaring a friend gives non-members of a class access to the
  658.     non-public members of a class.
  659.