gcc4.1.0: error: object missing in reference to
John Love-Jensen
eljay@adobe.com
Tue Dec 5 20:10:00 GMT 2006
Hi Perry,
> struct foo
> {
> typedef char buf_type[1024];
>
> buf_type buf;
> };
Yep, that also will work.
What's the optimal approach for Fabian depends on the problem at hand.
My tendency is to use a const, where the const would be implemented in terms
of the sizeof the buf in the context of a null pointer:
const size_t kBufSize = sizeof(((foo*)NULL)->buf);
Or, alternatively (when an option), go the other direction:
const size_t kBufSize = BUFFER_SIZE - HEADER_SIZE;
struct foo
{
char buf[kBufSize];
};
If a private: scoping is thrown into the mix, then that changes the game
plan. Hopefully in such a scenario all access is internal to the class
(nicely encapsulated), so the code that needs to sniff these things has
visible access to them.
Sincerely,
--Eljay
More information about the Gcc-help
mailing list