x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why does my uint64 overflow at 2^32-1 ?

This code:

 uint64 derp = 0;
 UE_LOG(HelloWorld, Error, TEXT("derp = %i"), derp);
 derp = 4294967295;
 UE_LOG(HelloWorld, Error, TEXT("derp = %i"), derp);
 derp = 4294967296;
 UE_LOG(HelloWorld, Error, TEXT("derp = %i"), derp);
 derp = 4294967297;
 UE_LOG(HelloWorld, Error, TEXT("derp = %i"), derp);

produces this output:

 HelloWorld:Error: derp = 0
 HelloWorld:Error: derp = -1
 HelloWorld:Error: derp = 0
 HelloWorld:Error: derp = 1

this is not the behavior I was expecting. What's going on here?

Product Version: Not Selected
Tags:
more ▼

asked Oct 05 '14 at 02:18 AM in C++ Programming

avatar image

icannotfly
31 9 12 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I think proper formatting is %ld and %lu - what happens in that case?

(EDIT: or even %lld and %llu to be on the safe side).

more ▼

answered Oct 05 '14 at 03:03 AM

avatar image

RCL STAFF
2.7k 59 6 88

avatar image icannotfly Oct 05 '14 at 04:28 AM

%llu did the trick, though this means I have a problem somewhere else in my code.

Thank you very much!

avatar image Motanum Apr 13 '17 at 02:32 PM

In code format, because I can't tell if it's a upper case i, or a lower case L.

 I think proper formatting is %ld and %lu - what happens in that case?
 
 (EDIT: or even %lld and %llu to be on the safe side).

Cheers

avatar image icannotfly Apr 13 '17 at 04:31 PM

it's a lowercase L, as in "long": "ld" would be "long decimal" and "lu" is "long unsigned"

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Replacing %i with %u yields:

 HelloWorld:Error: derp = 0
 HelloWorld:Error: derp = 4294967295
 HelloWorld:Error: derp = 0
 HelloWorld:Error: derp = 1
more ▼

answered Oct 05 '14 at 02:25 AM

avatar image

icannotfly
31 9 12 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question