I am porting existing VC12 compiler compatible code to VC14 (visual studio 2015) and I am facing code break problem.
Sample program to reproduce issue:
#include "iostream"
using namespace std;
#define mybuffer(param) ((param)->_flag & (_IOMYBUF))
int main()
{
mybuffer(stderr); // I don't understand what is the purpose of this line.
// So, facing issue in replacing this code statement.
return 0;
}
On visual studio 2013: above program works absolutely fine.
On visual studio 2015: above program gives compilation error.
Error C2039 '_flag': is not a member of '_iobuf'
Error C2065 '_IOMYBUF': undeclared identifier
Analysis:
In VS2013, wchar.h has following:
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
Where as in VS2015, in file: corecrt_wstdio.h
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
typedef struct _iobuf
{
void* _Placeholder;
} FILE;
#endif
Can you please help me in suggesting a fix for above error?