"unsigned int" and "int," what’s the fastest?

Asked

Viewed 462 times

2

In language C, enter unsigned int and int, what is the fastest type? I know (think) that unsigned can store larger numbers why int reserve a bit (space) for the signal and unsigned no. But which the fastest in practice?

  • 3

    Faster for what?

  • 1

    Calculations, incrementing and decreasing. More specifically in 'for' cycles'.

  • (post-incremeto and post-decrement as well, of course)

1 answer

2


It depends on the platform, but is generally the same. Use the unmarked types is more complicated than it seems and you should only use it if you really need it and understand all the implications, especially when they interact with flagged types. In grid part of the cases in loops for the most correct is to use size_t and not int as everyone uses. But it always depends on what you are doing, and in practice, in most cases, the result is the same.

  • What is size_t? and what does "flagged" and "unmarked mean"?

  • 1

    Translation of Signed and unsigned. https://answall.com/q/104118/101

Browser other questions tagged

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