Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - this option permits you to define a special prefix for the "const", http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
This option permits you to define a special prefix for the "CONST",
"CONST2", "_DATA", and "_BSS" segment names.  The name of the group to which
these segments belong is also changed from "DGROUP" to "<name>_GROUP".  This
option is especially useful in the creation of 16-bit Dynamic Link Library
(DLL) routines.
Example:

     C>compiler_name report /nd=spec

In the above example, the segment names become "specCONST", "specCONST2",
"spec_DATA", and "spec_BSS" and the group name becomes "spec_GROUP".

By default, the data group "DGROUP" consists of the "CONST", "CONST2",
"_DATA", and "_BSS" segments.  The compiler places certain types of data in
each segment.  The "CONST" segment contains constant literals that appear in
your source code.

Example:

     char *birds[ 3 ] = { "robin", "finch", "wren" };

     printf( "Hello world\n" );

In the above example, the strings "Hello world\n", "robin", "finch", etc.
 appear in the "CONST" segment.

The "CONST2" segment contains initialized read-only data.

Example:

     const int cvar = 1;
     int var = 2;
     int table[ 5 ] = { 1, 2, 3, 4, 5 };
     char *birds[ 3 ] = { "robin", "finch", "wren" };

In the above example, the constant variable cvar is placed in the "CONST2"
segment by the 16-bit C compiler and the 16-bit and 32-bit C++ compilers
(the 32-bit C compiler places it in the "_TEXT" segment).

The "_BSS" segment contains uninitialized data such as scalars, structures,
or arrays.

Example:

     int var1;
     int array1[ 400 ];

Other data segments containing data, specifically declared to be far or
exceeding the data threshold (see "zt" option), are named either
"module_nameN_DATA" when using the C compiler or "module_name_DATAN" when
using the C++ compiler where "N" is some integral number.

Example:

     int far array2[400];

In the above example, array2 is placed in the segment "report11_DATA" (C) or
"report_DATA1" (C++) provided that the module name is "report".

The macro __SW_ND will be predefined if "nd" is selected.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson