Tzset Sample Program Redefinition Errors in Large Model

ID Number: Q45228

5.10 | 5.10

MS-DOS | OS/2

docerr

The TZSET sample program given on Page 619 of the "Microsoft C 5.1

Run-time Library Reference" may yield the following errors:

error C2086: 'daylight' : redefinition

error C2086: 'timezone' : redefinition

error C2086: 'tzname' : redefinition

These errors occur only when compiling for the large or compact-memory

models.

The errors occur because under the large and compact-memory models,

the variable references default to far addresses, which contradicts

the external near declarations contained within the include file

TIME.H.

You may correct this problem by declaring the three variables in

your source as follows:

int near daylight;

long near timezone;

char * near tzname[];

More Information:

The include file, TIME.H, declares the variables as follows:

extern int near cdecl daylight;

extern long near cdecl timezone;

extern char * near cdecl tzname[2];