-qcommon

Category

Object code control

Pragma equivalent

None.

Purpose

Controls where uninitialized global variables are allocated.

When -qcommon is in effect, uninitialized global variables are allocated in the common section of the object file. When -qnocommon is in effect, uninitialized global variables are initialized to zero and allocated in the data section of the object file.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--+-common---+-------------------------------------------><
        '-nocommon-'   

Defaults

Usage

This option does not affect static or automatic variables, or the declaration of structure or union members.

This option is overridden by the common|nocommon and section variable attributes. See The common and nocommon variable attribute and The section variable attribute .

Predefined macros

None.

Examples

In the following declaration, where a and b are global variables:
int a, b:
Compiling with -qcommon produces the equivalent of the following assembly code:
.comm _a,4
.comm _b,4
Compiling with -qnocommon produces the equivalent of the following assembly code:
        .globl _a
.data
.zerofill __DATA, __common, _a, 4, 2
        .globl _b
.data
.zerofill __DATA, __common, _b, 4, 2

Related information