General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lepi Doptera
Low Level
comments
Comments by "Lepi Doptera" (@lepidoptera9337) on "do you know how "return" works under the hood? (are you SURE?)" video.
What about doing stupid things? We try to avoid doing stupid things. ;-)
1
@vladimir0rus Why would you return 18GB of data if you can return a 32 bit or 64 bit pointer to it? :-)
1
@vladimir0rus I know how data is being returned from my function calls. It's in the language specification and I occasionally look at the generated assembly. Let me give you some more attention, though. You are clearly lonely. :-)
1
@vladimir0rus Let me give you some more attention, then. :-)
1
@vladimir0rus Let me give you some more attention, then. ;-)
1
Function calls are always expensive. Real men use "inline". Oh, wait... your language doesn't have that? Serves you right for using a language for children. ;-)
1
That would be nice. Noooooooohhhh... a function call has to save the entire darn register set to the stack. Your optimizing compiler may try to get away without it, but in general function calls are very expensive operations. Try to avoid them if you care about performance.
1
That depends on your language. I am sure there are languages that are stupid enough to let you put 28GByte size arrays on the stack so that a function can modify a single byte... but why in the world would you want to do it that way? ;-)
1
Yeah, that works great... except that it won't work at all because you haven't saved your registers and there is no mechanism for passing arguments here. It's also not re-entrant safe. Welcome to interrupt hell. ;-)
1