News for hackers. Stuff that matters.
Re:The C++ standard for the F-35 Fighter Jet [video] by 0xffff2 on Monday December 08, 2025 @01:51PM (#46196117)
I honestly can't tell if you know a lot more than me or a lot less than me about how computers work... A couple of honest questions:

1. Where do you save the current value of the return address register before calling a function?

2. When parameters are "grouped into a structure" and the structure is passed as an argument to a function, where do you store that structure?

Re:The C++ standard for the F-35 Fighter Jet [video] by RealityVoid on Monday December 08, 2025 @02:21PM (#46196454)
Not OP, but presumably, the answers are:

1) You don't... hence, my question about no nested function calls. If you push it anywhere else, you can call it whatever you want, but you just re-invented the stack. I _guess_ you could do some wierd stuff to technically not get a stack, but... again, it's wierd. And for what, again?

2) Some fixed address. If you have for example:

```c

typeRealBigStructure foo;

void baz(typeRealBigStructure * struct){

    // Do whatever to struct
}

void bar(void){

  baz(&foo);
}

```

The foo will probably end up in the BSS and will take up that space for the whole lifetime of the program. That's not the heap, not the stack, just... a fixed location in memory where the linker placed it.

I guess on big PC's stuff is very dynamic and you use malloc for a lot of stuff, but in embedded C, it's a very common pattern.

Re:The C++ standard for the F-35 Fighter Jet [video] by 0xffff2 on Monday December 08, 2025 @02:33PM (#46196579)
Ah, you're right, the struct case is actually pretty straightforward (especially since recursion is likely forbidden anyway), I just have trouble contorting my brain to such a different viewpoint.
Re:The C++ standard for the F-35 Fighter Jet [video] by quietbritishjim on Monday December 08, 2025 @07:25PM (#46199713)
The sibling comment already answered your question, but just to add: As I mentioned earlier, this was actually how old programming languages worked. Famously(ish), Dijkstra secretly snuck recursive functions into the ALGOL 60 standard, thus forcing compiler authors to use a stack!

https://news.ycombinator.com/item?id=10131664