What is the name given to an unsigned "overflow"?

Asked

Viewed 131 times

1

Considering that answer in Soen would like to know what the nomenclature of when it occurs to try to store a value greater than the type unsigned int can contain as the result will be module UINT_MAX. Do you have any specific nomenclature when it occurs that the variable does not have the value assigned to it? It has specific nomenclature when the type is unsigned int?

1 answer

3


I do not know any specific official term, there uses a very common expression that is "wrap Around". In fact, what occurs with non-flagged types in C can even be called overflow, even by virtue of specification this is not what occurs, we can not call it overflow to not be well informally just to indicate that an error has occurred without worrying about what actually happened. See more about this at How -1 can be greater than 4?.

  • The nomenclature would be "defined behavior:)"

  • defined behavior It’s a lot, not only this.

  • @epx but 1+1 and UINT_MAX + 1 are not both defined behavior?

  • "defined behavior" is simply "definite behavior" in English, and does not need to be read as a technical term (although those huge glossaries defining terms that head some "RFC" type documents may have the expression). It is simply a "defined behavior" in the language specification that the number in question "goes around", and the value of NUM % (MAX_NUM + 1) is assigned the variable.

  • 1

    But it makes sense to use "overflow" when one is interested to know that the result did not fit in the destination, without taking into account the implication of this, and "wrap Around" describes precisely the implication of this in C. In another language the consequence of "overflow" could be an exception of "Valueerror", and so on.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.