On 05/07/2019 17:36, Ehsan Akhgari wrote:
On Thu, Jul 4, 2019 at 8:05 AM Gerald Squelart <gsquel...@mozilla.com>
wrote:

- Our latest coding style [1] points at Google's, which has a section
about Integer Types [3], and the basic gist is: Use plain `int` for
"not-too-big" numbers

If you can 100% guarantee that they will not be too big, right?

(In particular, for generation counters I would be somewhat worried
about making such a guarantee.)

They did add "use int64_t for "big" numbers".

In my own selfish case, it will be once per profiler start/stop. I'm
fairly confident a user won't start and stop the profiler a few billion
times in a session. :-D


FWIW once in a while I have come across bugs caused by truncation of
integers where someone picked a specific size that was too small also, e.g.
storing an offset into a text node in a 16-bit integer.  I think that's
maybe something that's hiding between the lines there, being careful with
that direction also if you pick a type with a specific size to make sure
your type is large enough.

Yep. Recent example: https://bugzilla.mozilla.org/show_bug.cgi?id=1556019 .

~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to