本文介绍了丑陋的国米宏pretation(仅1线)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
的#define STRING(S)(((字符串*)S)-1)
在世界上是什么(((字符串*)S)-1)
?
的typedef
结构字符串{
INT长;
INT能力;
无符号的检查;
炭ptr的[0];
}字符串;
解决方案
您正在铸造取值
到字符串*
。那么你减去一个来自它(使它指向previous等等)。
任何更具体需要知道字符串
的定义 - 但(漫天要价)我猜应用程序使用双VB / C风格的字符串(空终止,由长度pceded $ p $),并将该功能从适于C函数的形式(指针的第一个字符)转换它为一个可用于其它类型(指针的长度)
#define STRING(s) (((String*)s)-1)
what in the world is (((String*)s)-1)
?
typedef
struct String {
int length;
int capacity;
unsigned check;
char ptr[0];
} String;
解决方案
You're casting s
to a String *
. Then you're subtracting one from it (making it point to the previous whatever).
Anything more specific would need to know the definition of String
- but (WILD SPECULATION) I would guess the application uses dual VB/C-style strings (null terminated, preceded by the length), and this function changes it from a form suitable for C functions (pointer to the first character) into one usable for the other type (pointer to the length).
这篇关于丑陋的国米宏pretation(仅1线)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!