Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Performance of signed vs unsigned types
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Thomas Scrace, post: 4204049"] Hi Keith. I posted the relevant function in a previous post, but I will reproduce it here: The function is the same for the unsigned longs, except with the types of the two counter variables changed to unsigned. Scott Fluhrer pointed out that the explanation for the supernaturally fast enumeration of the 64bit longs was in the temp = -1 assignment. Because temp is an unsigned variable in the unsigned functions this actually ended up taking the value of ULONG_MAX, and the loop immediately terminated. The reason I did not realise the error was that I was looking for it to return ULONG_MAX; I just thought it was doing it in a different fashion. So, mystery solved! It's amazing how these apparently simple K&R exercises can lead to learning a lot more about the language than you initially expect. Thanks, Tom [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Performance of signed vs unsigned types
Top