[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: thoughts about BIC
From:       Thiago Macieira <thiagom () wanadoo ! fr>
Date:       2002-03-30 14:16:31
[Download RAW message or body]

Rolf Magnus wrote
>I was wondering if adding member variables always is BIC. Sure, it changes
> the size of the object (and if you don't append them to the end, the
> layout), but where is this size needed? AFAIK only on creation of the
> object, because the system needs to know how much storage to get for it.
> But if the allocation of storage is only done in the library that contains
> the class (e.g. for singletons or objects that are only created through a
> factory), this should not matter, right? So can member variables be added
> to such a class without making it BIC (if you don't let inline methods
> access them of course)?

I'd say that, if you want to modify the member variables, make sure that no 
one else accesses them at all.

I don't know it is allowed by the standards, but the compiler could just 
rearrange them. Besides, there's also inheritance, since the derived class 
must know the parent's size.

I'd recommend that, if those classes are shown to the user, that he get always 
pointers and that the member variables are at least protected. And you have 
to make sure no one is deriving from your class.

-- 
  Thiago Macieira - UFOT Registry number: 1001
 thiagom@mail.com
   ICQ UIN: 1967141  PGP: 0x8F2978D5 and 0xEA9037A5 (PGP 2.x)
     Registered Linux user #65028

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic