tag:blogger.com,1999:blog-11788780.post8200910441782984173..comments2023-12-29T13:22:33.104-08:00Comments on JJinuxLand: Call Me Crazy: Calling Conventionsjjinuxhttp://www.blogger.com/profile/03270879497119114175noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-11788780.post-89855623215782727562011-06-18T18:42:25.661-07:002011-06-18T18:42:25.661-07:00> JJ, that was the best article from you that I...> JJ, that was the best article from you that I've read. Really informative and interesting.<br /><br />Thanks, Dan. I had it banging around in the back of my mind for a few years, and it took being unemployed for a couple months to finally find enough time to write it.<br /><br />Happy Hacking!jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-71286264855420084262011-06-18T17:20:26.344-07:002011-06-18T17:20:26.344-07:00JJ, that was the best article from you that I'...JJ, that was the best article from you that I've read. Really informative and interesting.dan aronsonnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-76684153896847130332011-04-20T19:36:22.086-07:002011-04-20T19:36:22.086-07:00> In Ruby, “named arguments” are already a hash...> In Ruby, “named arguments” are already a hash. There is no conversion.<br /><br />I've clarified the text. Thanks.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-72560076342123945542011-04-20T18:08:04.718-07:002011-04-20T18:08:04.718-07:00In Ruby, “named arguments” are already a hash. The...In Ruby, “named arguments” are already a hash. There is no conversion.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-40282248081016896292011-04-20T17:03:41.402-07:002011-04-20T17:03:41.402-07:00> Why even mention it at all? It doesn't re...> Why even mention it at all? It doesn't really add any flexibility in passing arguments, just provides a better naming system.<br /><br />Okay, it's gone.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-50135306987569698412011-04-20T16:30:39.197-07:002011-04-20T16:30:39.197-07:00> Can you suggest some replacement text?
Why e...> Can you suggest some replacement text?<br /><br />Why even mention it at all? It doesn't really add any flexibility in passing arguments, just provides a better naming system.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-72277812698492280402011-04-20T14:33:05.133-07:002011-04-20T14:33:05.133-07:00> Still a bit iffy! :D
Can you suggest some re...> Still a bit iffy! :D<br /><br />Can you suggest some replacement text?jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-70901826407117798332011-04-20T14:27:15.344-07:002011-04-20T14:27:15.344-07:00(Smalltalk/Obj-C)
Still a bit iffy! :D
Basically...(Smalltalk/Obj-C)<br /><br />Still a bit iffy! :D<br /><br />Basically, on the declaration side you have a selector and parameter names (e.g. doStuffWithFoo: fooParam bar: barParam). Selector name is “public” — callers will have to use it to call the method, but parameter names are private to your code (just as argument names in most other languages). What you use on the caller side is just the selector; it doesn't even have to look like parameter names at all (you can have a method like "asdasd:dfdf:efef:").Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-84804874015629032011-04-20T13:10:29.438-07:002011-04-20T13:10:29.438-07:00> Am I completely incorrect in saying: Some C ...> Am I completely incorrect in saying: Some C compilers allow you to choose the subroutine calling mechanism when writing the function. Thus allowing calls to C functions to be made from any language for which the subroutine calling mechanism is known in the form of a dll.<br /><br />I don't know.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-5716529301365767122011-04-20T13:09:16.447-07:002011-04-20T13:09:16.447-07:00> You're wrong about Objective-C and Smallt...> You're wrong about Objective-C and Smalltalk. Neither of these really has a first-class support for keyword arguments. A method whose call looks like "createSphereWithMass: 1.0 size: 2.0" doesn't have keyword arguments "mass" and "size". It's just an arity 2 method called "createSphereWithMass:size:".<br /><br />Thanks for the correction. I've updated the text.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-83717749617250894602011-04-20T13:00:47.798-07:002011-04-20T13:00:47.798-07:00AReallyGoodName, thanks for the correction. I'...AReallyGoodName, thanks for the correction. I've updated the paragraph to include your text.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-32953439006559255462011-04-20T12:58:24.377-07:002011-04-20T12:58:24.377-07:00Am I completely incorrect in saying:
Some C compil...Am I completely incorrect in saying:<br />Some C compilers allow you to choose the subroutine calling mechanism when writing the function. Thus allowing calls to C functions to be made from any language for which the subroutine calling mechanism is known in the form of a dll.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-4059996286060168492011-04-20T12:55:27.245-07:002011-04-20T12:55:27.245-07:00Rotund, thanks for the correction. I've updat...Rotund, thanks for the correction. I've updated the text.jjinuxhttps://www.blogger.com/profile/03270879497119114175noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-43041347542633707952011-04-20T09:30:11.674-07:002011-04-20T09:30:11.674-07:00You're wrong about Objective-C and Smalltalk. ...You're wrong about Objective-C and Smalltalk. Neither of these really has a first-class support for keyword arguments. A method whose call looks like "createSphereWithMass: 1.0 size: 2.0" doesn't have keyword arguments "mass" and "size". It's just an arity 2 method called "createSphereWithMass:size:".<br /><br />It means that, for example, you can't shuffle arguments around (as it would be possible with first-class named arguments).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-58814836593921695832011-04-20T06:51:28.584-07:002011-04-20T06:51:28.584-07:00JJ, nice overview of the topology of subroutines! ...JJ, nice overview of the topology of subroutines! It was a good way to start the day.<br /><br />Hope you are well.<br /><br />-PatrickUnknownhttps://www.blogger.com/profile/01983314137137483949noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-80026234882716276062011-04-20T03:05:09.677-07:002011-04-20T03:05:09.677-07:00This was really fun to read, thanks!This was really fun to read, thanks!Unknownhttps://www.blogger.com/profile/06048659421994385015noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-12394038331535028142011-04-20T00:12:19.866-07:002011-04-20T00:12:19.866-07:00"AMD64 defined a new set of calling conventio..."AMD64 defined a new set of calling conventions for C"<br /><br />This isn't entirely true. AMD helped define the new calling conventions for System V on AMD64, not for AMD64 or C in general. <br /><br />In fact calling convention is neither C language or AMD64 hardware dependent. It's entirely defined by the Operating Systems application binary interface standard.<br /><br />In fact, the calling conventions for AMD64 systems is slightly different under Windows. Specifically in relation to what registers are used to pass variables.<br />http://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_Calling_ConventionsAReallyGoodNamehttp://www.reddit.com/programmingnoreply@blogger.comtag:blogger.com,1999:blog-11788780.post-20987948122573862312011-04-19T23:37:49.897-07:002011-04-19T23:37:49.897-07:00Excellent article! It was a lot of fun rapidly go...Excellent article! It was a lot of fun rapidly going over different ways to call.Geoffhttps://www.blogger.com/profile/08622588934358741418noreply@blogger.comtag:blogger.com,1999:blog-11788780.post-8086682300271249372011-04-19T22:52:17.767-07:002011-04-19T22:52:17.767-07:00Paragraph 3 actually has a fairly minor problem in...Paragraph 3 actually has a fairly minor problem in that you did not describe the calling conventions of a language like C but instead a language like Pascal. In C, the caller is in charge of cleaning arguments off the stack. This is required to properly handle vargs.Joe "Rotund" Tennieshttps://www.blogger.com/profile/15738276878886073220noreply@blogger.com