![]() |
| | #1 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| My little stack library - what do you think? Please no flaming, I just want your comments. ![]() Download Code: Table of contents
BIN--------|
| DLL------|
| | C----|
| | | libstackc.a
| | | stackc.dll
| | |
| | C++--|
| | libstackcpp.a
| | stackcpp.dll
| STATIC---|
| | libstackc.a
| | libstackcpp.a
| stack.h
| stack.hpp
|
EXAMPLE----|
| stackexample.c
| stackexample.cpp
|
SRC--------|
C----|
| dll-----|
| | Stack Library.dev
| | stack.c
| | stack.h
| |
| static--|
| Stack Library.dev
| stack.c
| stack.h
|
|
C++--|
dll-----|
| Stack Library.dev
| stack.cpp
| stack.hpp
|
static--|
Stack Library.dev
stack.cpp
stack.hpp
|
| hauzer is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| My main question would be "why?" - at least in C++, stack would typically be best implemented as a template, which would make it a .h only implementation. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #3 |
| Ex scientia vera Join Date: Sep 2007
Posts: 426
| Why not, rather? The best exercise to learn is to code. Almost everything you can possibly due within a reasonable time-frame in your own home as a hobby has been done before. It's all about the learning experience.
__________________ "What's up, Doc?" "'Up' is a relative concept. It has no intrinsic value." |
| IceDane is offline | |
| | #4 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| I think it is painfully obvious that you're not a C++ dev, hauzer. The C++ implementation leaves a little to be desired. And I would like to comment that you should not strip the names of the parameters from function prototypes. I'm sorry, but seeing as you use C-style functions and methods, I think you better scrap the C++ version and focus on your C version or learn C++ a little better before you attempt.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #5 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| Well, as IceDane said, I wrote it only to exercise myself, specificly in the pointer&memory area of C because I'm a little thin there. Maybe someone will find it as a good example, I don't know. EDIT: @Elysia: yeah, I know. I really didn't experiment with C++ features much, maybe it's time. |
| hauzer is offline | |
| | #6 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| I see... then I can suggest that you learn new/delete, templates, possible smart pointers and vectors. It would probably make a much better class. Oh and usually C++ devs use T* instead of T * because it's strictly typed. Just a thought, no need to change. Good luck anyway.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #7 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| Thanks everyone. |
| hauzer is offline | |
![]() |
| Tags |
| library, stack, stack library |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Stack Implementation and Exceptions | audinue | C Programming | 4 | 06-22-2008 09:32 AM |
| error trying to compile stack program | KristTlove | C++ Programming | 2 | 11-03-2003 06:27 PM |
| Stack | planet_abhi | C Programming | 2 | 04-12-2003 04:22 AM |
| Stack functions as arrays instead of node pointers | sballew | C Programming | 8 | 12-04-2001 11:13 AM |
| inputting line of text vs. integers in STACK | sballew | C Programming | 17 | 11-27-2001 11:23 PM |