Re: gcc4.1.0: error: object missing in reference to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux