![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Why are you putting "Functions" in a header file, instead of a source file? Presumably, these would be commonly used utility functions. In any but a trival, one-source-file program, such an approach would cause multiple definitions. These should be defined in a source file and declared in a header file.
You refer to it in a comment as a "class", but you show no class definition. A namespace is not a class, despite similarities. You may define classes in a header file because they are a pattern to be instantiated elsewhere.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 155
Rep Power: 3
![]() |
@grumpy:
It's my first experience with bigger projects, and I think I've started badly with this project, right from the start. That's why I'll start from the scratch again, and then try to make it better. All your suggestions, haven't been waste of time, I've listened to them, and tried what I could to follow them. I just haven't could find much related to these things, in my code. About badalloc, then I actually forgot to check it within the try...catch. :o @DaWei: About the first thing, yes you're right, my bad. The other thing; I wrote wrong, it should be "function", not "class". Anyway, thanks for the help, both of you. I seems like I have to read alot more about pointers, before I'm going into bigger projects.
__________________
-- v0id
|
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5
![]() |
Unfortunately, that doesn't explain your problem. If operator new failed, it would throw an exception and the program would exit unless the exception was caught. It would not cause a problem AFTER main() has returned, and not with operator delete.
|
|
|
|
|
|
#14 | |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 155
Rep Power: 3
![]() |
Quote:
What I meant, was that I actually forgot to catch bad_alloc. I was only catching some objects I'd made by myself, and no other, not even catch(...); I just looked at you little article about exceptionhandling (DaWei's signature), and I'm gonna read that, so I can better at exceptionhandling too.
__________________
-- v0id
|
|
|
|
|
|
|
#15 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5
![]() |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Heap vs. Stack memory | Eric the Red | C++ | 11 | Oct 24th, 2006 6:18 PM |
| Objective C Memory Management problems | Soulstorm | Other Programming Languages | 12 | Jun 28th, 2006 7:54 AM |
| When to use the new keyword in C++? | titaniumdecoy | C++ | 28 | Mar 16th, 2006 12:36 PM |
| Problems with atoi(), getting memory value instead of int | omdown | C++ | 5 | Nov 1st, 2005 11:41 PM |
| Pointers in C (Part I) | Stack Overflow | C | 4 | Apr 28th, 2005 7:03 PM |