this post was submitted on 02 Aug 2023
1448 points (98.0% liked)

Programmer Humor

31324 readers
26 users here now

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

Rules:

founded 4 years ago
MODERATORS
 

I'm doing you a favor

you are viewing a single comment's thread
view the rest of the comments
[–] rmuk@feddit.uk 11 points 11 months ago (1 children)

Steadily increasing unsigned integer on a long-running piece of infrastructure: bonjour

[–] socsa@lemmy.ml 3 points 11 months ago* (last edited 11 months ago) (1 children)

Laughs in

struct LooooongCounter {
    long highPart;
    long lowPart;
};
[–] TheyCallMeHacked@discuss.tchncs.de 3 points 11 months ago
LooooongCounter operator++(const LooooongCounter& c) {
    if(c.lowPart == ULONG_MAX) {
        c.highPart++;
        c.lowPart = 0;
    }
    else c.lowPart++;
}