#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;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re casting
sto aString *. 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).