There is no syntax to accomplish your direct ask in C. The closest you can come is to create temporary variables.
int *xptr = &longAndExpressiveName->x;
int vel_x = longAndExpressiveName->vel.x;
*xptr += vel_x;
Your desire to use longAndExpressiveName
is misplaced in this case, because in C++, you are coming from a syntax where longAndExpressiveName
is not passed as a parameter, and the parameter is implicitly hidden by the implicit this->
. The C++ syntax for the caller would be:
longAndExpressiveName->func();
And you are translating that into:
func(longAndExpressiveName);
And then you propagate that same name to the parameter name. While it may be appropriate for the caller to refer to the pointer with a long and expressive name, it is not really helpful to the "member" function. But, what would be helpful is if the function is named so that you know it is meant to do something to a particular kind of structure.
void func_Data(Data * const d) {
d->x += d->vel.x;
}
Which better captures the original C++ syntax:
void Data::func () {
x += vel.x;
}