Export (0) Print
Expand All

_osplatform, _osver, _winmajor, _winminor, _winver 

These variables store build and version numbers of the 32-bit Windows operating systems. These variables have been deprecated because more secure functional equivalents are available.

Global variable Functional equivalent

_osplatform

_get_osplatform

_osver

_get_osver

_winmajor

_get_winmajor

_winminor

_get_winminor

_winver

_get_winver

Declarations for these variables in Stdlib.h are as follows.


extern unsigned int _osplatform;
extern unsigned int _osver;
extern unsigned int _winmajor;
extern unsigned int _winminor;
extern unsigned int _winver;

These variables are useful in programs that run in different versions of the Windows operating systems.

Variable Description

_osplatform

Current platform.

_osver

Current build number.

_winmajor

Major version number.

_winminor

Minor version number.

_winver

Holds value of _winmajor in high byte and value of _winminor in low byte.

These global variables have been deprecated because the CRT cannot guarantee that they are initialized before they are used. Unpredictability in Windows DLL startup means that the CRT's DLL main might not run before the user's DLL main, meaning data exports might be uninitialized. This could lead to unsafe behavior, so global variable accesses should be replaced by calls to the appropriate functional equivalents which can return an error if the CRT is uninitialized.

Community Additions

ADD
Show:
© 2014 Microsoft