Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Anyone tried using STL (Standard Template Library)?   Message List  
Reply | Forward Message #9131 of 15019 |
RE: Anyone tried using STL (Standard Template Library)?

Maciej Sinilo <yrp@...> wrote:

> >> Has anyone tried using the C++ Standard Template Library with the
> >> DevKitAdv or other gcc-based setup? If so, did you have any luck
> >> getting it to work?
> >
> > The problem must be with DevKitAdv: we use the STL (and Boost)
> > extensively in our project with the gcc compiler from Nintendo (for
> > registered developers) without any problems.
>
> Aren't you afraid of code bloat? Using STL tends to result in very
> big code being generated (of course it depends which parts do you
> use, I don't expect std::min to add kilobytes, but you wrote you use
> it extensively, so I guess you talk about containers/algorithms?).

Code "bloat" could be a problem if you are very tight on ROM space,
but your images and other data will have a much bigger impact than
code. The reason I put bloat in quotes is that it sounds like your
code will get huge if you just put "#include <list>" in your file,
but compilers _need_ to only generate code for elements you use.
That means that even if you use std::list, but don't use the merge()
function of that template, code will not be generated for it. Also
consider that if you tend to need to keep containers of several
different types of objects around (don't we all?), you only have a
few options. If code bloat is your primary concern, you could write
your own list implementation that stores void pointers that you cast
to/from (run & compile time efficient but not type safe). You could
make your own list implementation for each object type that you will
be using (still efficient and type safe, but redundant, error prone,
and bigger binary). Or you could let templates do the dirty work
for you (only downside is a bigger binary).

There are other factors to keep in mind as well: the STL is already
written which saves you much time and effort, it's relatively bug free
which also save you time and effort, it's highly optimized (you would
probably never write code that efficient yourself), and it has complex
containers and algorithms (do you really want to write your own red-
black tree or inner product function?), etc.

So before you dismiss templates because of bloat, you should weigh
whether or not they will be worthwhile in your particular situation,
considering the measurable and estimated, schedule, run, and compile
time impacts of templates versus other solutions.


Toby Hutton <vjfaq5yxe12s001@...> wrote:
>
> Gcc's STL sucks arse. If you've used STL elsewhere you'll find the
> GNU version very limited.
>
> In my professional experience we've always avoided using STL, but
> that's mainly because it's absolutely not portable (which isn't
> really a problem here.) Well, STL itself is portable but each of
> the implementations aren't.

GCC's STL implementation might be bad, I wouldn't know: when we found
out how bad the Visual C++ implementation was a few years back, we
switched to STLport and use it in all of our projects. It is a free,
highly portable, quality implementation. You really should investigate
it (www.stlport.org). You will probably have to set a few configuration
options, especially for AGB development (see example below).

Good luck,
Ben


#define _STLP_NO_OWN_IOSTREAMS 1 // use compiler's default IO streams
#define _STLP_NO_EXTENSIONS 1 // use standard STL without enhancements
#define _STLP_USE_NEWALLOC 1 // use compiler's "new" for allocations
#define _STLP_NO_EXCEPTIONS 1 // disable exceptions
#define _STLP_NO_DEBUG_EXCEPTIONS 1 // thrown from __stl_debug_terminate

#if defined(DEBUG) || defined(_DEBUG)
#define _STLP_DEBUG 1
#define _STLP_ASSERTIONS 1
#define _STLP_DEBUG_UNINITIALIZED 1
#define _STLP_SHRED_BYTE ((unsigned char)'\xA3')
#endif

#ifdef AGB
// turn off IO streams altogether
#ifdef _STLP_NO_OWN_IOSTREAMS
#undef _STLP_NO_OWN_IOSTREAMS
#endif
#define _STLP_NO_IOSTREAMS 1

#define _STLP_NO_WCHAR_T 1 // no wide character support
#define _STLP_NO_THREADS 1 // no threading support

#if defined(DEBUG) || defined(_DEBUG)
#define _STLP_DEBUG_MESSAGE 1
#define _STLP_DEBUG_TERMINATE 1
#endif
#endif


--
Benbuck Nason
"Of course we gotta pay rent, so money connects, but I'd rather be broke
and have a whole lot of respect." - O.C.







Thu Jan 3, 2002 12:19 am

totalnubee
Offline Offline
Send Email Send Email

Forward
Message #9131 of 15019 |
Expand Messages Author Sort by Date

Hi Folks, Has anyone tried using the C++ Standard Template Library with the DevKitAdv or other gcc-based setup? If so, did you have any luck getting it to...
ternarybrian
Offline Send Email
Dec 26, 2001
2:34 pm

... The problem must be with DevKitAdv: we use the STL (and Boost) extensively in our project with the gcc compiler from Nintendo (for registered developers)...
Ben Nason
totalnubee
Offline Send Email
Dec 27, 2001
10:12 pm

Hello Ben, ... Aren't you afraid of code bloat? Using STL tends to result in very big code being generated (of course it depends which parts do you use, I ...
Maciej Sinilo
yarpen2002
Offline Send Email
Dec 28, 2001
7:12 pm

... Gcc's STL sucks arse. If you've used STL elsewhere you'll find the GNU version very limited. In my professional experience we've always avoided using STL,...
Toby Hutton
vjfaq5yxe12s001@...
Send Email
Dec 29, 2001
1:40 am

... Code "bloat" could be a problem if you are very tight on ROM space, but your images and other data will have a much bigger impact than code. The reason I...
Ben Nason
totalnubee
Offline Send Email
Jan 3, 2002
1:58 am

i would avoid stl at all costs. i even avoid c++ cos it tends to use precious memory - i know for a fact it does using the ARM tools, anyone have any knowledge...
Morten Pedersen
escapekey@...
Send Email
Jan 9, 2002
9:22 am

Hello Morten, ... It's not that bad, IMHO. As long as you know what you're doing and examine generated code from time to time, that is. But I've only used ...
Maciej Sinilo
yarpen2002
Offline Send Email
Jan 9, 2002
2:18 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help