Hi William! Thank you for the email. It has clarified the things for me. :) I still have one question though. Do I understand right that I need also to cast types with these types from inttypes.h? So use it not only in the defenitions. - sprintf(buf, "%lu", (long unsigned int)maxsize); + sprintf(buf, "%" PRIu64, (uint64_t)maxsize); Thanks, Simon ----- Original Message ----- > From: "William Brown" <william@xxxxxxxxxxxxxxxx> > To: "389-devel" <389-devel@xxxxxxxxxxxxxxxxxxxxxxx> > Sent: Thursday, March 8, 2018 12:42:03 AM > Subject: Use of int types in the code base, > > Hi there, > > http://www.port389.org/docs/389ds/development/coding-style.html#types > > In a few reviews I still see this sometimes. > > It's pretty important that we keep moving our quality standard higher, > and having known type sizes is important to this. Types like int and > long are unknown sizes until you compile it depending on platform. > > As a result, it's really important we use the intX_t and uintX_t types > so we have guarantees of our values. I would encourage the use of > int64_t and uint64_t, because while they are "larger", it's > significantly faster for a modern 64bit system to process these values > than their 32bit counterparts. > > Another note is that arrays index by size_t, not 'int', so we should > always keep this in mind. > > Finally, because we are using c99 now, this means we should avoid: > > size_t i = 0; > > for (i = 0; i < cond; i++) { > ... > } > > When we really should scope our values. Scoping is good because it > limits possibility of data corruption to flow and other mistakes such > as re-use of values. This means: > > for (size_t i = 0; i < cond; i++) { > ... > } > > Thanks! > > -- > Thanks, > > William Brown > _______________________________________________ 389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx