Questions tagged [stack-based]

23 questions
80
votes
8 answers

registers vs stacks

What exactly are the advantages and disadvantages to using a register-based virtual machine versus using a stack-based virtual machine? To me, it would seem as though a register based machine would be more straight-forward to program and more…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
24
votes
3 answers

Why did microsoft's developers choose to make the .NET a stack based machine?

Today I've found the Disassembler IL between the tools provided with VS2008. I tried to disassemble a program and give a look to the result. Opcodes weren't so hard to understand but one thing surprised me: the .NET is stack based?! Reading "Write…
BlackBear
  • 22,411
  • 10
  • 48
  • 86
8
votes
2 answers

How would I go about Implementing A Simple Stack-Based Programming Language

I am interested in extending my knowledge of computer programming by implementing a stack-based programming language. I am seeking out advice on where to begin, as I intend for it to have functions like "pushint 1" which would push an integer with…
jszaday
  • 322
  • 1
  • 4
  • 12
6
votes
1 answer

Why are register-based virtual machines better than stack-based ones?

Why are register-based virtual machines better than stack-based ones? Specifically, in the Parrot VM's document, the designer explains the benefits of register machines: [...] many programs in high-level languages consist of nested function and…
Pteromys
  • 1,441
  • 2
  • 12
  • 29
6
votes
1 answer

How would a register + stack based virtual machine work?

I know how register based and how stack based virtual machines work independently. I know the advantages and disadvantages of both. What I want to know is that has anyone ever tried to merge the two? I tried to search the net for the existence of…
5
votes
2 answers

something like stackbased objects in c++ for javascript

Looking for a construct in javascript which works like the destructor in stackbased or local object in c++, e.g. #include class M { public: int cnt; M() {cnt=0;} void inc() {cnt++;} ~M() {printf ("Count is %d\n",…
MGrant
  • 308
  • 1
  • 5
4
votes
2 answers

Building a web application with Factor

Has anybody built a web application with Factor? What were some of the stumbling blocks or problems that you encountered during the process?
Ryan Duffield
  • 18,497
  • 6
  • 40
  • 40
4
votes
0 answers

Stack cookie instrumentation code detected a stack-based buffer overrun - Fixed

so I am having a few issues with this program used to pixelate an image. One issue is that I get a "Stack around the variable 'pixArray' was corrupted" and then, when I click continue after breaking it gives the error in the title. I'm not sure if…
3
votes
3 answers

Does Forth support multithreading?

I had a short look at the Forth programming language for a while. Is it possible to do multithreading with synchronization primitives in Forth? For example, is it possible to do n-by-n matrix multiplication with multiple threads in Forth? If so,…
user3810155
2
votes
1 answer

Stack based array declaration in Objective-C?

In Objective-C, I declare a C array like this: int length = 10; int a[length]; This does not cause any errors in Xcode but other compliers like Visual Studio. Please tell me how it works. Should I use it or use malloc/calloc instead?
nminhtai
  • 130
  • 6
2
votes
1 answer

System Error:An Overrun of a stack-based buffer in windows system file explorer.exe

I'm having an issue with windows. when I opened it, the screen is getting black every time and refreshes it. I opened it in safe mode and the error is showing that An Overrun of a stack-based buffer in Explorer.exe. Please Help me to fix it. The…
Ayman Amjad
  • 264
  • 2
  • 10
1
vote
1 answer

Recognition of stack-bases language

Does anyone know what language this could be? ([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][[]+[])[+[]]+([![]]+[][[]]) …
sadn
  • 13
  • 2
1
vote
1 answer

Stack-Based Languages: Pros/Cons of a Register?

I'm currently designing an esoteric stack-based programming language for code golf (International Phonetic Esoteric Language/IPEL) that, in its current spec, has a stack of values that the user can modify. However, after trying some simple…
1
vote
2 answers

Necessity of the 'rot' operator

Why does Forth implement the rot operator, and why does it operate on exactly the three top-most items of the stack? Is it just for convenience or would Forth not be Turing-complete without such an instruction? Is the number of three the minimum…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
1
vote
5 answers

I need C++ array class template, which is fixed-size, stack-based and doesn't require default constructor

So, I've been looking at boost::array but it does require default constructor defined. I think the best way of filling this array with data, would be through a push_back(const T&) method. Calling it more times than SIZE (known at compile-time) would…
andriej
  • 2,118
  • 3
  • 22
  • 28
1
2