_FAR_NO_NAMELESS_UNIONS
The macro _FAR_NO_NAMELESS_UNIONS controls whether the
FarDialogItem
structure uses anonymous unions. Anonymous unions are a language feature that is allowed by the C++
standard but not supported in ANSI C.
If the macro _FAR_NO_NAMELESS_UNIONS is not defined, the
FarDialogItem
structure will be compatible with FAR Manager versions
prior to FAR 1.70 beta 3 (inclusive). So the
FarDialogItem structure will have the
following form:
struct FarDialogItem { ... union { int Selected; char *History; char *Mask; struct FarList *ListItems; CHAR_INFO *VBuf; }; ... union { char Data[512]; struct { DWORD PtrFlags; int PtrLength; char *PtrData; char PtrTail[1]; } Ptr; }; };So to access the
Data
member of the
FarDialogItem structure
it will be suficient to write Data
, and to access the Selected
member
- Selected
.
If the macro _FAR_NO_NAMELESS_UNIONS is defined, the structure will use named unions. Then it will be compatible with ANSI C compilers, but will not be source-level compatible with plugins written for FAR 1.65. The structure will have the following form:
struct FarDialogItem { ... union { int Selected; char *History; char *Mask; struct FarList *ListItems; CHAR_INFO *VBuf; } Param; ... union { char Data[512]; struct { DWORD PtrFlags; int PtrLength; char *PtrData; char PtrTail[1]; } Ptr; } Data; };
In this case to access the Data
member of the structure
you will have to write Data.Data
, and to access the Selected
member
- Param.Selected
.
The macro must be defined before the
#include "plugin.hpp"
directive:
#define _FAR_NO_NAMELESS_UNIONS #include "plugin.hpp"
Attention!
- In FAR 1.70 beta 4, the default variant is compatible with old plugins (_FAR_NO_NAMELESS_UNIONS is not defined). However, in FAR 1.70 release the new default will be _FAR_NO_NAMELESS_UNIONS. So if you want your plugins to be source-level compatible with FAR 1.70 release, you can right now define the _FAR_NO_NAMELESS_UNIONS macro and modify the source code of your plugins accordingly.
See also: