Article View: comp.lang.c++.leda
Article #31Re: STRING_CONSTRUCTOR limits strings to 512 byte
From: Thomas Malik
Date: Tue, 08 Aug 1995 14:22
Date: Tue, 08 Aug 1995 14:22
58 lines
3046 bytes
3046 bytes
In article <DCLDB9.ArI@cunews.carleton.ca>, dfs@doe.carleton.ca (David F. Skoll) writes:
|> In article <3viuuv$dcl@news.rwth-aachen.de>, Peter Haumer
|> (haumer@informatik.rwth-aachen.de) wrote:
|>
|> > The macro STRING_CONSTRUCTOR in _string.c limits the size of strings to
|> > 512 bytes. I don't think that this is necessary. Does anybody know, why it
|> > is is implemenented in this way?
|> ...
|> A nicer solution, IMO, is for LEDA authors to define left-shift
|> operators like this:
|>
|> string & string::operator<<(int i) { ... }
|> string & string::operator<<(double d) { ... }
|> etc...
|>
|> Then you could say:
|>
|> string s;
|> int a=4, b=6;
|> s << a << " times " << b << " equals " << a*b;
|>
|> which would append to s. This is type-safe and more "C++-like".
|>
|> --
|> David F. Skoll
|> <a HREF="http://www.doe.carleton.ca/students/dfs/">
|> Click here for my home page</a> "Query two pi" on typewriter.
|>
Why don't you simply use the strstream class ? It's much more elegant (i.e. it
allocates it's own memory as needed) than LEDA's printf-like Constructors, and
i think it's pretty standard in the C++ world.
I've just looked over the code in _string.cc , it's the most ugly stuff I've
seen so far (and i've produced many ugly things in my lifetime ...). I think
working with fixed sized arrays for creation/formatting is generally a stupid
idea. They've got so many beautiful data structures, why don't they simply keep a
list of fixed size buffers and cat them together when reading/construction is
complete ?
Besides this, i like the LEDA data types very much, especially the list/graph
stuff. They've just better put some more work into the basics & into Makefile/
configuration stuff (when i get a LEDA version, i don't even try to compile with
their provided Makefiles, i throw them away just after unpacking ... )
--
===============================================================================
|
_/_/_/_/_/_/_/_/_/_/_/ _/ _/_/ |
_/ _/_/ _/ _/ | Thomas Malik
_/ _/ _/ _/ _/ | malik@serv-400.dfki.uni-kl.de
_/ _/ _/ _/ | malik@sun.rhrk.uni-kl.de
_/ _/ _/ | Berliner Str. 5-11
_/ _/ _/ | 6750 Kaiserlautern
_/ _/ _/ | (0631) 79868
_/ _/ _/ _/ _/ |
Technical Details
Message-ID:
<407rv8$okh@serv-200.dfki.uni-kl.de>Path:
arc1-ca.pugleaf.net!dfki.uni-kl.de!malikReferences:
<3viuuv$dcl@news.rwth-aachen.de> <DCLDB9.ArI@cunews.carleton.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!dfki.uni-kl.de!malik From: malik@alvserv-2.dfki.uni-kl.de (Thomas Malik) Newsgroups: comp.lang.c++.leda Subject: Re: STRING_CONSTRUCTOR limits strings to 512 byte Date: 8 Aug 1995 14:22:32 GMT Organization: DFKI Kaiserslautern Sender: malik@dfki.uni-kl.de (Thomas Malik) Distribution: world Message-ID: <407rv8$okh@serv-200.dfki.uni-kl.de> References: <3viuuv$dcl@news.rwth-aachen.de> <DCLDB9.ArI@cunews.carleton.ca> NNTP-Posting-Host: serv-400.dfki.uni-kl.de