Forum > General

maximum number of parameters of a method

(1/5) > >>

is it 255?

I have a idiot function (data recording) that needs to get a huge (about 350) number of params and it does not compile. The reason why I do not put them into a record and have a single parameter is that when function will be modified to include extra values, I want it to stop compiling before I supply everywhere all newly requested parameters (if I use a record I need to find all cals and make sure new parameters are filled as well, for sure this won't happen).
In following program 255 works, while 256 does not.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{ Welcome to GDB Online.GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.Code, Compile, Run and Debug online from anywhere in world. } {$mode objfpc} program Hello; function DoTheJob( a001: Integer;a002: Integer;a003: Integer;a004: Integer;a005: Integer;a006: Integer;a007: Integer;a008: Integer;a009: Integer;a010: Integer;a011: Integer;a012: Integer;a013: Integer;a014: Integer;a015: Integer;a016: Integer;a017: Integer;a018: Integer;a019: Integer;a020: Integer;a021: Integer;a022: Integer;a023: Integer;a024: Integer;a025: Integer;a026: Integer;a027: Integer;a028: Integer;a029: Integer;a030: Integer;a031: Integer;a032: Integer;a033: Integer;a034: Integer;a035: Integer;a036: Integer;a037: Integer;a038: Integer;a039: Integer;a040: Integer;a041: Integer;a042: Integer;a043: Integer;a044: Integer;a045: Integer;a046: Integer;a047: Integer;a048: Integer;a049: Integer;a050: Integer;a051: Integer;a052: Integer;a053: Integer;a054: Integer;a055: Integer;a056: Integer;a057: Integer;a058: Integer;a059: Integer;a060: Integer;a061: Integer;a062: Integer;a063: Integer;a064: Integer;a065: Integer;a066: Integer;a067: Integer;a068: Integer;a069: Integer;a070: Integer;a071: Integer;a072: Integer;a073: Integer;a074: Integer;a075: Integer;a076: Integer;a077: Integer;a078: Integer;a079: Integer;a080: Integer;a081: Integer;a082: Integer;a083: Integer;a084: Integer;a085: Integer;a086: Integer;a087: Integer;a088: Integer;a089: Integer;a090: Integer;a091: Integer;a092: Integer;a093: Integer;a094: Integer;a095: Integer;a096: Integer;a097: Integer;a098: Integer;a099: Integer;a100: Integer;a101: Integer;a102: Integer;a103: Integer;a104: Integer;a105: Integer;a106: Integer;a107: Integer;a108: Integer;a109: Integer;a110: Integer;a111: Integer;a112: Integer;a113: Integer;a114: Integer;a115: Integer;a116: Integer;a117: Integer;a118: Integer;a119: Integer;a120: Integer;a121: Integer;a122: Integer;a123: Integer;a124: Integer;a125: Integer;a126: Integer;a127: Integer;a128: Integer;a129: Integer;a130: Integer;a131: Integer;a132: Integer;a133: Integer;a134: Integer;a135: Integer;a136: Integer;a137: Integer;a138: Integer;a139: Integer;a140: Integer;a141: Integer;a142: Integer;a143: Integer;a144: Integer;a145: Integer;a146: Integer;a147: Integer;a148: Integer;a149: Integer;a150: Integer;a151: Integer;a152: Integer;a153: Integer;a154: Integer;a155: Integer;a156: Integer;a157: Integer;a158: Integer;a159: Integer;a160: Integer;a161: Integer;a162: Integer;a163: Integer;a164: Integer;a165: Integer;a166: Integer;a167: Integer;a168: Integer;a169: Integer;a170: Integer;a171: Integer;a172: Integer;a173: Integer;a174: Integer;a175: Integer;a176: Integer;a177: Integer;a178: Integer;a179: Integer;a180: Integer;a181: Integer;a182: Integer;a183: Integer;a184: Integer;a185: Integer;a186: Integer;a187: Integer;a188: Integer;a189: Integer;a190: Integer;a191: Integer;a192: Integer;a193: Integer;a194: Integer;a195: Integer;a196: Integer;a197: Integer;a198: Integer;a199: Integer;a200: Integer;a201: Integer;a202: Integer;a203: Integer;a204: Integer;a205: Integer;a206: Integer;a207: Integer;a208: Integer;a209: Integer;a210: Integer;a211: Integer;a212: Integer;a213: Integer;a214: Integer;a215: Integer;a216: Integer;a217: Integer;a218: Integer;a219: Integer;a220: Integer;a221: Integer;a222: Integer;a223: Integer;a224: Integer;a225: Integer;a226: Integer;a227: Integer;a228: Integer;a229: Integer;a230: Integer;a231: Integer;a232: Integer;a233: Integer;a234: Integer;a235: Integer;a236: Integer;a237: Integer;a238: Integer;a239: Integer;a240: Integer;a241: Integer;a242: Integer;a243: Integer;a244: Integer;a245: Integer;a246: Integer;a247: Integer;a248: Integer;a249: Integer;a250: Integer;a251: Integer;a252: Integer;a253: Integer;a254: Integer;a255: Integer//;a256: Integer): Integer;begin  Result := 1+a001+a002+a003+a004+a005+a006+a007+a008+a009+a010+a011+a012+a013+a014+a015+a016+a017+a018+a019+a020+a021+a022+a023+a024+a025+a026+a027+a028+a029+a030+a031+a032+a033+a034+a035+a036+a037+a038+a039+a040+a041+a042+a043+a044+a045+a046+a047+a048+a049+a050+a051+a052+a053+a054+a055+a056+a057+a058+a059+a060+a061+a062+a063+a064+a065+a066+a067+a068+a069+a070+a071+a072+a073+a074+a075+a076+a077+a078+a079+a080+a081+a082+a083+a084+a085+a086+a087+a088+a089+a090+a091+a092+a093+a094+a095+a096+a097+a098+a099+a100+a101+a102+a103+a104+a105+a106+a107+a108+a109+a110+a111+a112+a113+a114+a115+a116+a117+a118+a119+a120+a121+a122+a123+a124+a125+a126+a127+a128+a129+a130+a131+a132+a133+a134+a135+a136+a137+a138+a139+a140+a141+a142+a143+a144+a145+a146+a147+a148+a149+a150+a151+a152+a153+a154+a155+a156+a157+a158+a159+a160+a161+a162+a163+a164+a165+a166+a167+a168+a169+a170+a171+a172+a173+a174+a175+a176+a177+a178+a179+a180+a181+a182+a183+a184+a185+a186+a187+a188+a189+a190+a191+a192+a193+a194+a195+a196+a197+a198+a199+a200+a201+a202+a203+a204+a205+a206+a207+a208+a209+a210+a211+a212+a213+a214+a215+a216+a217+a218+a219+a220+a221+a222+a223+a224+a225+a226+a227+a228+a229+a230+a231+a232+a233+a234+a235+a236+a237+a238+a239+a240+a241+a242+a243+a244+a245+a246+a247+a248+a249+a250+a251+a252+a253+a254+a255//+a256   ;end; varv001: Integer = 1;v002: Integer = 1;v003: Integer = 1;v004: Integer = 1;v005: Integer = 1;v006: Integer = 1;v007: Integer = 1;v008: Integer = 1;v009: Integer = 1;v010: Integer = 1;v011: Integer = 1;v012: Integer = 1;v013: Integer = 1;v014: Integer = 1;v015: Integer = 1;v016: Integer = 1;v017: Integer = 1;v018: Integer = 1;v019: Integer = 1;v020: Integer = 1;v021: Integer = 1;v022: Integer = 1;v023: Integer = 1;v024: Integer = 1;v025: Integer = 1;v026: Integer = 1;v027: Integer = 1;v028: Integer = 1;v029: Integer = 1;v030: Integer = 1;v031: Integer = 1;v032: Integer = 1;v033: Integer = 1;v034: Integer = 1;v035: Integer = 1;v036: Integer = 1;v037: Integer = 1;v038: Integer = 1;v039: Integer = 1;v040: Integer = 1;v041: Integer = 1;v042: Integer = 1;v043: Integer = 1;v044: Integer = 1;v045: Integer = 1;v046: Integer = 1;v047: Integer = 1;v048: Integer = 1;v049: Integer = 1;v050: Integer = 1;v051: Integer = 1;v052: Integer = 1;v053: Integer = 1;v054: Integer = 1;v055: Integer = 1;v056: Integer = 1;v057: Integer = 1;v058: Integer = 1;v059: Integer = 1;v060: Integer = 1;v061: Integer = 1;v062: Integer = 1;v063: Integer = 1;v064: Integer = 1;v065: Integer = 1;v066: Integer = 1;v067: Integer = 1;v068: Integer = 1;v069: Integer = 1;v070: Integer = 1;v071: Integer = 1;v072: Integer = 1;v073: Integer = 1;v074: Integer = 1;v075: Integer = 1;v076: Integer = 1;v077: Integer = 1;v078: Integer = 1;v079: Integer = 1;v080: Integer = 1;v081: Integer = 1;v082: Integer = 1;v083: Integer = 1;v084: Integer = 1;v085: Integer = 1;v086: Integer = 1;v087: Integer = 1;v088: Integer = 1;v089: Integer = 1;v090: Integer = 1;v091: Integer = 1;v092: Integer = 1;v093: Integer = 1;v094: Integer = 1;v095: Integer = 1;v096: Integer = 1;v097: Integer = 1;v098: Integer = 1;v099: Integer = 1;v100: Integer = 1;v101: Integer = 1;v102: Integer = 1;v103: Integer = 1;v104: Integer = 1;v105: Integer = 1;v106: Integer = 1;v107: Integer = 1;v108: Integer = 1;v109: Integer = 1;v110: Integer = 1;v111: Integer = 1;v112: Integer = 1;v113: Integer = 1;v114: Integer = 1;v115: Integer = 1;v116: Integer = 1;v117: Integer = 1;v118: Integer = 1;v119: Integer = 1;v120: Integer = 1;v121: Integer = 1;v122: Integer = 1;v123: Integer = 1;v124: Integer = 1;v125: Integer = 1;v126: Integer = 1;v127: Integer = 1;v128: Integer = 1;v129: Integer = 1;v130: Integer = 1;v131: Integer = 1;v132: Integer = 1;v133: Integer = 1;v134: Integer = 1;v135: Integer = 1;v136: Integer = 1;v137: Integer = 1;v138: Integer = 1;v139: Integer = 1;v140: Integer = 1;v141: Integer = 1;v142: Integer = 1;v143: Integer = 1;v144: Integer = 1;v145: Integer = 1;v146: Integer = 1;v147: Integer = 1;v148: Integer = 1;v149: Integer = 1;v150: Integer = 1;v151: Integer = 1;v152: Integer = 1;v153: Integer = 1;v154: Integer = 1;v155: Integer = 1;v156: Integer = 1;v157: Integer = 1;v158: Integer = 1;v159: Integer = 1;v160: Integer = 1;v161: Integer = 1;v162: Integer = 1;v163: Integer = 1;v164: Integer = 1;v165: Integer = 1;v166: Integer = 1;v167: Integer = 1;v168: Integer = 1;v169: Integer = 1;v170: Integer = 1;v171: Integer = 1;v172: Integer = 1;v173: Integer = 1;v174: Integer = 1;v175: Integer = 1;v176: Integer = 1;v177: Integer = 1;v178: Integer = 1;v179: Integer = 1;v180: Integer = 1;v181: Integer = 1;v182: Integer = 1;v183: Integer = 1;v184: Integer = 1;v185: Integer = 1;v186: Integer = 1;v187: Integer = 1;v188: Integer = 1;v189: Integer = 1;v190: Integer = 1;v191: Integer = 1;v192: Integer = 1;v193: Integer = 1;v194: Integer = 1;v195: Integer = 1;v196: Integer = 1;v197: Integer = 1;v198: Integer = 1;v199: Integer = 1;v200: Integer = 1;v201: Integer = 1;v202: Integer = 1;v203: Integer = 1;v204: Integer = 1;v205: Integer = 1;v206: Integer = 1;v207: Integer = 1;v208: Integer = 1;v209: Integer = 1;v210: Integer = 1;v211: Integer = 1;v212: Integer = 1;v213: Integer = 1;v214: Integer = 1;v215: Integer = 1;v216: Integer = 1;v217: Integer = 1;v218: Integer = 1;v219: Integer = 1;v220: Integer = 1;v221: Integer = 1;v222: Integer = 1;v223: Integer = 1;v224: Integer = 1;v225: Integer = 1;v226: Integer = 1;v227: Integer = 1;v228: Integer = 1;v229: Integer = 1;v230: Integer = 1;v231: Integer = 1;v232: Integer = 1;v233: Integer = 1;v234: Integer = 1;v235: Integer = 1;v236: Integer = 1;v237: Integer = 1;v238: Integer = 1;v239: Integer = 1;v240: Integer = 1;v241: Integer = 1;v242: Integer = 1;v243: Integer = 1;v244: Integer = 1;v245: Integer = 1;v246: Integer = 1;v247: Integer = 1;v248: Integer = 1;v249: Integer = 1;v250: Integer = 1;v251: Integer = 1;v252: Integer = 1;v253: Integer = 1;v254: Integer = 1;v255: Integer = 1;//v256: Integer = 1;begin  writeln ('Hello World');  DoTheJob(  v001, v002, v003, v004, v005, v006, v007, v008, v009, v010, v011, v012, v013, v014, v015, v016, v017, v018, v019, v020, v021, v022, v023, v024, v025, v026, v027, v028, v029, v030, v031, v032, v033, v034, v035, v036, v037, v038, v039, v040, v041, v042, v043, v044, v045, v046, v047, v048, v049, v050, v051, v052, v053, v054, v055, v056, v057, v058, v059, v060, v061, v062, v063, v064, v065, v066, v067, v068, v069, v070, v071, v072, v073, v074, v075, v076, v077, v078, v079, v080, v081, v082, v083, v084, v085, v086, v087, v088, v089, v090, v091, v092, v093, v094, v095, v096, v097, v098, v099, v100, v101, v102, v103, v104, v105, v106, v107, v108, v109, v110, v111, v112, v113, v114, v115, v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126, v127, v128, v129, v130, v131, v132, v133, v134, v135, v136, v137, v138, v139, v140, v141, v142, v143, v144, v145, v146, v147, v148, v149, v150, v151, v152, v153, v154, v155, v156, v157, v158, v159, v160, v161, v162, v163, v164, v165, v166, v167, v168, v169, v170, v171, v172, v173, v174, v175, v176, v177, v178, v179, v180, v181, v182, v183, v184, v185, v186, v187, v188, v189, v190, v191, v192, v193, v194, v195, v196, v197, v198, v199, v200, v201, v202, v203, v204, v205, v206, v207, v208, v209, v210, v211, v212, v213, v214, v215, v216, v217, v218, v219, v220, v221, v222, v223, v224, v225, v226, v227, v228, v229, v230, v231, v232, v233, v234, v235, v236, v237, v238, v239, v240, v241, v242, v243, v244, v245, v246, v247, v248, v249, v250, v251, v252, v253, v254, v255//, v256); end. 

Why not use an array for your parameters? You can easy iterate over to know how much you got etc...

Sorry to be blunt, but this is a really idiotic means of using a function with parameters.

--- Quote from: tt on March 21, 2023, 05:24:20 pm ---The reason why I do not put them into a record and have a single parameter is that when function will be modified to include extra values...
--- End quote ---

That's what an array is for.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function DoTheJob(a: array of integer): Integer;begin  // you can use assert(length(a) = 230); or whatever to check the number of elements in a and give an exception if it's something else  


--- Quote from: tt on March 21, 2023, 05:24:20 pm ---is it 255?
--- End quote ---

Yes, it simply makes no sense to pass that many parameters and even 255 is already insanely high.

As others already wrote use a smarter approach to pass the parameters.

It's great that someone stresses the compiler to the limits and tries what can squeeze out of it!  :D


[0] Message Index

[#] Next page

Go to full version