r/badcode • • Apr 07 '21

java Apparently Java can only handle 255 parameters in a constructor...

Post image
4.0k Upvotes

249 comments sorted by

View all comments

64

u/Siggi_pop Apr 07 '21

What a strange number 255, why not round up to 300 /s

18

u/vinicius_kondo Apr 07 '21

We should increase the parameter stack size from 8bit to 16bit so we can pass 65k parameters.

6

u/Terrain2 Apr 07 '21

16 bit is a horrible idea, we need 128-bit stack size!

5

u/[deleted] Apr 07 '21

Yeah, it doesn't looks very... LOGIC... *drumroll noise

-12

u/pizzafoot_1057 Apr 07 '21

This value is likely stored in 7 bits (111 1111 in binary), where the max possible integer is 255, or (28)-1.

Binary is far more convenient for machines than decimal.

11

u/Siggi_pop Apr 07 '21

But...but I used the /s

Since we are on this subject, is my calculator broken?

27 = 128, It seems I need at least 8 bit. 28 = 256 (255 zero indexed)

4

u/23Silicon Apr 07 '21

You have been wooshed

1

u/[deleted] Aug 15 '22 edited Jun 08 '23

I have deleted Reddit because of the API changes effective June 30, 2023.

1

u/pizzafoot_1057 Aug 16 '22

I recall, this had been the day I learned about it in school.