Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Boost array help

Author
Message
Zeal
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 9th Jul 2006 08:21
So I just had a nasty runin with a 'array out of bounds' bug. At least dbpro would crash if you went out of bounds, c++ runs along like nothing is wrong, just to screw with you.

Anyway I was told I NEEDED to start using 'boost' array, so I downloaded it, but im at a loss as far as how to "include" it. I tryed adding the folders to my options -> vc++ directories (like I did for dark sdk) but that didnt work. I skimmed the boost site and all I saw was something about writing your own 'jam' program to include the library? Guh?

Zuh?

All you need is zeal
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2006 16:45
The array header doesn't require you to build a library to use it, so you don't need to bother with bjam.

You are on the right track as far as setting up your VC++ include directory. For example, I have boost installed in C:\DevLibs\boost_1_33_1 (that's where the index.htm file is), it's added to the include path, and I #include "boost/array.hpp".

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Zeal
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 9th Jul 2006 22:02 Edited at: 9th Jul 2006 22:04
Hurray for IanM! I dont know why that didnt work before... All I did was include the directory in my projects folder, then say #include "boost\array.hpp". Works great now



Now it crashes as it should! I wont even have to rewrite any of my code, just change the declarations!

And it DOESNT crash in release mode, which is good right? That means it doesnt waste time doing bounds checks in release mode?

hurray for boost!

All you need is zeal
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2006 22:16
Yep, when you use [] it uses asserts that only function when compiled in debug mode, and are compiled out in release mode. If you need runtime checking you can use the at() member function to get it to throw an exception if you go out of bounds.

For free Plug-ins and source code http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-11-19 06:39:13
Your offset time is: 2024-11-19 06:39:13