Quick Stack question

This is a discussion on Quick Stack question within the C Programming forums, part of the General Programming Boards category; Ok from searching on the net it appears to me that there is no standard library for dealing with a ...

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Quick Stack question

    Ok from searching on the net it appears to me that there is no standard library for dealing with a stack. Is this correct?

  2. #2
    ggs
    ggs is offline
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    did search of include directory

    no, not for c
    .sect signature

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    The reason is, there are many ways to implement a stack. A stack is really just a concept of how a process works. You could implement it using an array, which you'll see commonly used in books when they introduce you to stacks. You could implement it using a linked list. Push a node onto the stack, pop it off. The point is, there are numerous ways to implement the concept. That's probably why there is no "standard" way of dealing with stacks and queues.

    Qzuah.
    Hope is the first step on the road to disappointment.

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Thanks you two.

    Another question, what about using the process' stack directly ala ASM push and pop without doing inline asm. Is that a possibility?

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I don't know that you'd want to. The stack space is where all your function calls and such are being piled. You probably wouldn't want to tinker with that, since the program itself is going to be using it. You wouldn't want some function call overwriting the stack space you're trying to use, or vice versa.

    I assume you'd be trying to manipulate this for speed reasons or some such? Otherwise, I don't see the point of trying to use the stack space of the process itself manually.

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Actually I'm thinking of doing it for "overwelming my C teacher with crazyness" effect.

    Ultimate goal is to have only one variable for the entire program which is a pointer to a memory location, with all functions called by deferencing function pointers, and doing my own parameter passing.

    Yes I'm bored

    (ASM class is making me eviler)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finished Stack
    By the pooper in forum C Programming
    Replies: 11
    Last Post: 02-02-2005, 09:52 AM
  2. error trying to compile stack program
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2003, 05:27 PM
  3. What am I doing wrong, stack?
    By TeenyTig in forum C Programming
    Replies: 2
    Last Post: 05-27-2002, 02:12 PM
  4. stack make file problem
    By puckett_m in forum C Programming
    Replies: 2
    Last Post: 11-22-2001, 10:51 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21