this post was submitted on 02 Aug 2023
1389 points (97.9% liked)

Programmer Humor

33101 readers
1133 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

I'm doing you a favor

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 3 points 2 years ago* (last edited 2 years ago) (1 children)

Laughs in

struct LooooongCounter {
    long highPart;
    long lowPart;
};
[โ€“] [email protected] 3 points 2 years ago
LooooongCounter operator++(const LooooongCounter& c) {
    if(c.lowPart == ULONG_MAX) {
        c.highPart++;
        c.lowPart = 0;
    }
    else c.lowPart++;
}