Skip to content
Snippets Groups Projects
  • Vladimir Davydov's avatar
    ed23ef3a
    json: use int instead of uint64_t for array indexes · ed23ef3a
    Vladimir Davydov authored
    Unsigned types are like a plague - should you use it once, and it will
    quickly spread throughout your whole code base, because comparing an
    unsigned value with a signed one without type conversion will make the
    compiler whine. However, they are less efficient, because the compiler
    has to guarantee that integer overflow works predictably for them.
    That said let's make json_token::num signed. Let's also use a plain int
    for it rather than int64_t, because it's highly unlikely that the
    capacity of int won't be enough to store a tuple index.
    ed23ef3a
    History
    json: use int instead of uint64_t for array indexes
    Vladimir Davydov authored
    Unsigned types are like a plague - should you use it once, and it will
    quickly spread throughout your whole code base, because comparing an
    unsigned value with a signed one without type conversion will make the
    compiler whine. However, they are less efficient, because the compiler
    has to guarantee that integer overflow works predictably for them.
    That said let's make json_token::num signed. Let's also use a plain int
    for it rather than int64_t, because it's highly unlikely that the
    capacity of int won't be enough to store a tuple index.