i found a releative manual page about l-value on msdn.
you can check it here: https://msdn.microsoft.com/en-us/library/bkbs2cds.aspx
there is an example in this page, but it dose not work as it shows.
msdn上的左值演示,微软的扩展支持,当强制转换一个左值但不会改变变量的长度的时候,转换完依旧是一个左值,msdn上的示例也是想表达这个,但是实际测试的时候并没有其说明的效果,两个赋值表达式都是编译错误。
char *p ;
short i;
long l;
(long *) p = &l ; /* Legal cast */ // this statement can not complie sucess
(long) i = l ; /* Illegal cast */
i am not sure what's your result.
here is an example of mime:
然后自己写了一个实例,将char*类型指针转换成int*指针的时候,指针就无法自加了
char* pBuffer = new char[1024];
((int*)pBuffer)++; // the result is the same as the previous. it will issue : ++ need l-value
and the /ZA is not including in the complie cmd line.
the main purpose is that, the midl.exe will generate the samiliar code as previous. such as:
类似的midl编译一个idl文件生成的对应c文件中也有类似代码,并不能直接编译通过。不知道是不是哪里没有设置好。
[ RPCSync_s.c ]
Result = 0;
RpcTryFinally
{
RpcTryExcept
{
if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
Param1 = *(( int __RPC_FAR * )_StubMsg.Buffer)++; // issue error: ++ need l-value
Param2 = *(( int __RPC_FAR * )_StubMsg.Buffer)++; // issue error: ++ need l-value
i am waiting for code god to help me here, thk very much!