ProgrammerHumor

whatDidIDoWrongHere

whatDidIDoWrongHere
https://i.redd.it/x9wsd2djmxbf1.png
Reddit

Discussion

coriolis7

Integer overflow

10 hours ago
New-Resolution9735

For an integer to overflow on a modern 64 bit system, it would need to be at least 9,223,372,036,854,775,807. Assuming we're counting in inches that's 145,570,897,046,319 miles, 1,566,022 astronomical units, or about ~24.7 light years.

Meaning your schlong could wrap around the entire solar system about 3.16 times. At the bare minimum required for an integer overflow

10 hours ago
monke_soup

Damn it, so close to 3.14

9 hours ago
undo777

It's even closer to pi

9 hours ago
ReallyMisanthropic
:cp::py::ts:

That's why C++ calls that type long long.

C++26 will rename it to long schlong.

9 hours ago
doctormyeyebrows

Easy, it's converting inches to 1/2,000,000,000,000,000,000 of an inch in its calculations. For accuracy.

edit: had to adjust the metric to allow overflow to actually happen oops

7 hours ago
veselin465

edit: had to adjust the metric to allow overflow to actually happen oops

If you write a code with the intention to get errors, then you are a real programmer. Unlike the wannabes who pretend it was an accident

1 hour ago
Clairifyed

Now is that enough to collapse under its own gravity 🤔 I am lazy and stuck on mobile for now, so can’t be bothered to do the math

7 hours ago
lefloys

I dont think it makes sense to do it in inches. what about 1.5 inches? it breaks down with an int

3 hours ago
Jonnypista

I haven't measured mine, but it seems about that size

2 hours ago
qqqrrrs_

In many 64 bit systems, `int` is still 32 bit

2 hours ago
DramaticCattleDog
:js::ts::py:

I feel personally attacked

10 hours ago
OneFriendship5139

woman

10 hours ago
whitakr

transman

9 hours ago
Clairifyed

Sure I suppose, really any category besides cis endosex man has some examples that work here, though some trans men do get bottom surgery

6 hours ago
whitakr

You’re right too! But also, some women don’t have vaginas. Wasn’t saying transman as a correction, I was listing it as another option.

6 hours ago
Clairifyed

Ah, for the record, I am not the one who downvoted it, though I suppose that’s what they assumed, or they didn’t like the lack of a space between “trans” and “man”. It is sometimes seen as a dog whistle

6 hours ago
binterryan76

It's called an innie

10 hours ago
MoveInteresting4334
:rust::j::ts::py::hsk:

DickLengthError

$100 to the first person who can slip this past PR.

4 hours ago
SkollFenrirson
:cs:

lolnumberfunny amirite guise

9 hours ago
ChickenSpaceProgram
:j::ftn::c::cp:

r/freebottomsurgery

7 hours ago
inthemindofadogg

Working on the next big AI project I see.

9 hours ago
tacticalpotatopeeler
:bash:

Buy a bigger truck

5 hours ago
karbonator

It's supposed to be positive 69420

7 hours ago
TeaKingMac

I'm guessing it's asking for length in "male internet dick units" in which a 13" dick is normal length, an 8" dick is barely there, and anything less is negative

9 hours ago
eat3er

Hey, that's my exit code!

8 hours ago
rosuav

For starters, there aren't that many signals, so you can't exit with a code that negative. If you're going to make fake screenshots, at least make them plausible. C'mon.

10 hours ago
TripsOverWords

An application return value of zero means success, any other value means failure. Unless the operating system strictly constrains a return value, it doesn't matter whether the value is infinitely positive or negative. Any value other than zero just means "failure" unless specified.

10 hours ago
rosuav

Have you tried it? Operating systems DO constrain the return values.

10 hours ago
SneeKeeFahk

Windows explicitly states that the exit code is just an unsigned int: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess

10 hours ago
TripsOverWords

That API may accept unsigned, but the main process returns a signed int. I believe this stems from all Windows system error codes being positive values. Ultimately it's the same whether signed or not though.

https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-

10 hours ago
rosuav

Your main *function* can return a signed number, but the actual process return value is defined to be unsigned. You have to misinterpret it as signed in order to get that effect.

9 hours ago
rosuav

Unsigned indeed.

10 hours ago
SneeKeeFahk

I guess technically 0 to 4294967295 is a constraint.

9 hours ago
rosuav

Yes, it is, and one that excludes the OP's choice.

9 hours ago
SneeKeeFahk

Have you ever been called pedantic before? 

8 hours ago
TripsOverWords

Yes. On Windows and Linux, main can return any value within the limit of a signed integer, and as expected any value other than 0 is interpreted as the process failing.

Throws basically the same error as the post.

Process exited with code -69420.

10 hours ago
rosuav

I don't have Windows to confirm, but on Linux, no, you cannot return any arbitrary value.

CompletedProcess(args=['python3', '-c', 'exit(-1234)'], returncode=46)

On Windows, the ExitProcess function is defined as accepting an unsigned integer, so since I can't actually test it, I have to assume that the docs are correct, and that negative numbers are folded to positive.

9 hours ago
nobody0163
:c::cp::cs::py::ts::asm:

Yes you can (on Windows at least). int main() { return -69420; }

10 hours ago
rosuav

Of course you can do that, but you can also try to return a string or anything else ridiculous. What matters is what the calling process receives - did you confirm that?

9 hours ago
nobody0163
:c::cp::cs::py::ts::asm:

I checked it. It returned -69420.

9 hours ago