Understanding Kdevelop Source Code

Alexander Richardson arichardson.kde at gmail.com
Sat Mar 14 20:37:05 UTC 2015

2015-03-14 20:04 GMT+00:00 Lucas Tanure <tanure at linux.com>:
> Hi,
> I'm studying kdevelop code to in the future help the project. So, I
> have a small question :
> kdevplatform/serialization/itemrepository.h:98
> enum {
>     ItemRepositoryBucketSize = 1<<16
> };
> Why do this way ? What are the benefits?
> Why not ?
> #define ItemRepositoryBucketSize 65536
I can't comment on the 65536 vs 1 << 16, but I would always use an
enum over a #define for integer constants since both have no runtime
overhead but #defines could break code such as

int ItemRepositoryBucketSize = 15;

While it is unlikely that this would happen with
ItemRepositoryBucketSize, there might be enumertors where this is a
real issue. Also once we can use c++11 strongly typed enums it is easy
to tell whether the value needs to be stored in an int or an int64,


More information about the KDevelop-devel mailing list