I have tried variations using sizeof() with unreliable results. This method works, but is it bogus? Can it be improved? I am not worried about it being portable.
// -- Unit Variables -- struct { // Complex Structure // Lots of nested arrays, // integer values, etc. } message; char replyBuffer[20]; // Input Buffer // Return size of message structure unsigned int getMessageSize(void) { int i, *p1, *p2; p1 = (int *)&message; // Create pointer to Message Struct p2 = (int *)&replyBuffer; // Create pointer to replyBuffer i = p2-p1; // Calculate message structure size return(i); // Does this really work? }