linux-gcc-digest Friday, January 14 2000 Volume 01 : Number 402
In this issue:
make check error in 2.9.5.0.22
libraries
Re: libraries
Re: libraries
Saving data
Re: Saving data
Re: Saving data
bsd signals
Re: bsd signals
Crosscompiling from linux to a fresh new format
dynamic libraries
list-faq?
Re: list-faq?
Fwd
Re: Crosscompiling from linux to a fresh new format
Re: dynamic libraries
CORBA
Missing header files
dynamic array allocation
Re: bsd signals
Re: dynamic libraries
Re: dynamic array allocation
Re: dynamic libraries
Re: dynamic libraries
Re: Missing header files
so version
Re: so version
Compile on Linux, and run win95 is possible?
Re: so version
Re: Compile on Linux, and run win95 is possible?
Re: dynamic array allocation
Re: CORBA
Fatel signal 11
Re: Fatel signal 11
Re: Fatel signal 11
stl question
Re: stl question
Re: Fatel signal 11
stl const_iterator question.
Re: Fatel signal 11
Speed of loading shared libs
Re: Speed of loading shared libs
Re: Speed of loading shared libs
Re: stl const_iterator question.
Re: Speed of loading shared libs
Re: stl const_iterator question.
Re: stl const_iterator question.
Re: stl const_iterator question.
See the end of the digest for information on subscribing to the linux-gcc
or linux-gcc-digest mailing lists.
----------------------------------------------------------------------
From: "Felix A. Koop" <[EMAIL PROTECTED]>
Date: Sat, 11 Dec 1999 08:34:23 +0100 (MET)
Subject: make check error in 2.9.5.0.22
Hi, I get the following testcase error when doing a make check in binutils
ld section:
ld-shared: FAIL (non PIC, load offset)
I compiled binutils with CFLAGS=-O2 LIBCFLAGS="-g -O2" on
i586-pc-linux-gnu with gcc 2.95.2 and libc2.0.7.
Further information can be provided upon request.
Greetings
Felix A. Koop
[EMAIL PROTECTED]
------------------------------
From: "Great One" <[EMAIL PROTECTED]>
Date: Mon, 13 Dec 1999 12:53:17 -0800
Subject: libraries
hi
I'm rewriting my Win32 code for Linux
Is there a way how to link a dynamic library really dynamicly,
just like using LoadLibrary function ?
thank you
------------------------------
From: Kurt Wall <[EMAIL PROTECTED]>
Date: Mon, 13 Dec 1999 07:13:29 -0700
Subject: Re: libraries
On Mon, Dec 13, 1999 at 12:53:17PM -0800, Great One wrote:
>
> hi
> I'm rewriting my Win32 code for Linux
> Is there a way how to link a dynamic library really dynamicly,
> just like using LoadLibrary function ?
Have a look at dlopen and family, prototyped in /usr/include/dlfcn.h.
Kurt
------------------------------
From: [EMAIL PROTECTED]
Date: Mon, 13 Dec 1999 13:21:53 EST
Subject: Re: libraries
Maybe not _just like_ (I don't do windose), but libdl should do. See
man dlopen (dlsym, dlerror, dlclose). Or, if you must have LoadLibrary,
get wine and port your code to winelib.
ftp://metalab.unc.edu/pub/Linux/ALPHA/wine/development/Wine-991212.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-991212.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/Wine-991212.tar.gz
ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/Wine-991212.tar.gz
or see http://www.winehq.com
Lawson
>< Microsoft free environment
This mail client runs on Wine. Your mileage may vary.
On Mon, 13 Dec 1999, Great One wrote:
>
> hi
> I'm rewriting my Win32 code for Linux
> Is there a way how to link a dynamic library really dynamicly,
> just like using LoadLibrary function ?
>
> thank you
>
>
>
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: Dale Appleby <[EMAIL PROTECTED]>
Date: Mon, 13 Dec 1999 20:04:28 -0800 (PST)
Subject: Saving data
OK, I realize this is pretty simple but...
I have wrote a simple program to keep stats for our local pool league...
Problem is I can't figure out how to save the data to disk (and get
the same values back).
Could someone please show me how to save, for eg: int a[10]
to disk, and then retrieve the same values back into "a"?
Thanks for your patience,
- ----------------------------------
E-Mail: Dale Appleby <[EMAIL PROTECTED]>
Date: 13-Dec-99
Time: 19:57:13
- ----------------------------------
------------------------------
From: Kurt Wall <[EMAIL PROTECTED]>
Date: Mon, 13 Dec 1999 22:24:36 -0700
Subject: Re: Saving data
On Mon, Dec 13, 1999 at 08:04:28PM -0800, Dale Appleby wrote:
> OK, I realize this is pretty simple but...
>
> I have wrote a simple program to keep stats for our local pool league...
>
> Problem is I can't figure out how to save the data to disk (and get
> the same values back).
You have lots of options. Do you want save straight data without
regard to format, or are you saving formatted data?
> Could someone please show me how to save, for eg: int a[10]
> to disk, and then retrieve the same values back into "a"?
For example, for formatted output:
*fptr = fopen("somefile", "w");
if(fptr != NULL) {
fprintf(fptr, "%d", a[10]);
} else {
fprint(stderr, "%s\n", "write to 'somefile' failed\n");
}
Short version: please provide more information.
Kurt
------------------------------
From: [EMAIL PROTECTED]
Date: Tue, 14 Dec 1999 00:24:03 EST
Subject: Re: Saving data
Here is an ugly little example for you:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(){
int a[10] = {1,2,3,4,5,6,7,8,9,10};
int fd;
fd = open("/usr/local/foo",O_RDWR | O_CREAT | O_TRUNC, S_IRWXU);
write(fd, &a, 40);
close(fd);
bzero(a,40);
fd = open("/usr/local/foo", O_RDONLY | O_CREAT, S_IRWXU);
read(fd, &a, 40);
close(fd);
printf("%d\n", a[7]);
return 0; }
Of course, you should check if each function succeeds, and take evasive
action if it doesn't. You should read man open, close, man 3 read, and
write to see what they return. Or maybe you would rather use streams
and formatted IO, it will be more portable from one architecture to
another: fopen, fprintf, fscanf, fclose... the possibilities are
endless.
If you don't like to read man pages, try info -f libc and follow the
menus.
Lawson
>< Microsoft free environment
This mail client runs on Wine. Your mileage may vary.
On Mon, 13 Dec 1999, Dale Appleby wrote:
> OK, I realize this is pretty simple but...
>
> I have wrote a simple program to keep stats for our local pool
league...
>
> Problem is I can't figure out how to save the data to disk (and get
> the same values back).
>
> Could someone please show me how to save, for eg: int a[10]
> to disk, and then retrieve the same values back into "a"?
>
> Thanks for your patience,
>
>
> ----------------------------------
> E-Mail: Dale Appleby <[EMAIL PROTECTED]>
> Date: 13-Dec-99
> Time: 19:57:13
> ----------------------------------
>
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: Joao Pedras <[EMAIL PROTECTED]>
Date: Wed, 15 Dec 1999 00:45:04 -0000 (GMT)
Subject: bsd signals
Hello all!
I am in need to run on linux a small app that calls other apps and leaves them
running in background. What's so special about this ? It is suitable for
performing this kind of operation from php3 scripts.
My problem is that this was conceived to work on bsd systems and I have heard
that bsd signals stuff in linux should be taken into consideration, in order to
make it work properly on linux. This doesn't perform ok on linux without
modifications which I am not qualified to perform.
It compiles ok, but, when I run it, the called app doesn't stay on the
background.
Here's the code :
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int pid;
pid=fork();
if (pid!=0)
{
pid=setsid();
close(STDOUT_FILENO);
close(STDIN_FILENO);
close(STDERR_FILENO);
execl(argv[1],argv[2],0);
}
return 0;
}
Any help would be appreciated.
Thanks
Joao
^\ /^
O O
- ----------------------------------------o00-(_)-00o--------------------------
Sent on 15-Dec-99 at 00:39:40
Powered by FreeBSD -> http://www.freebsd.org <- "The Power to Serve"
More info @ http://www.freebsddiary.org/freebsd/ - http://www.daemonnews.org/
- -----------------------------------------------------------------------------
PGP key available upon request or may be cut at
http://pedras.webvolution.net/pgpkey.html
- -----------------------------------------------------------------------------
Noncombatant, n.:
A dead Quaker.
-- Ambrose Bierce
------------------------------
From: [EMAIL PROTECTED]
Date: Wed, 15 Dec 1999 00:04:28 EST
Subject: Re: bsd signals
On Wed, 15 Dec 1999, Joao Pedras wrote:
> Hello all!
>
> I am in need to run on linux a small app that calls other apps and
leaves them
> running in background. What's so special about this ? It is suitable
for
> performing this kind of operation from php3 scripts.
> My problem is that this was conceived to work on bsd systems and I have
heard
> that bsd signals stuff in linux should be taken into consideration, in
order to
> make it work properly on linux. This doesn't perform ok on linux
without
> modifications which I am not qualified to perform.
> It compiles ok, but, when I run it, the called app doesn't stay on the
> background.
>
> Here's the code :
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> int main(int argc, char *argv[])
> {
> int pid;
>
> pid=fork();
>
> if (pid!=0)
I don't think so. fork returns the pid of the child process to the
parent, and zero to the child, so you are telling the child to return,
and the parent to setsid and execl. setsid will fail with eperm every
time. No wonder there are so many broken families nowadays. BSD
signals are ot the only signals getting crossed here. Try reversing the
test, so:
if (pid==0)
and see if that does what you want.
> {
> pid=setsid();
> close(STDOUT_FILENO);
> close(STDIN_FILENO);
> close(STDERR_FILENO);
> execl(argv[1],argv[2],0);
> }
>
> return 0;
> }
>
> Any help would be appreciated.
>
> Thanks
>
> Joao
> ^\ /^
> O O
>
- ----------------------------------------o00-(_)-00o--------------------------
> Sent on 15-Dec-99 at 00:39:40
> Powered by FreeBSD -> http://www.freebsd.org <- "The Power to Serve"
> More info @ http://www.freebsddiary.org/freebsd/ -
http://www.daemonnews.org/
>
- -----------------------------------------------------------------------------
> PGP key available upon request or may be cut at
> http://pedras.webvolution.net/pgpkey.html
>
- -----------------------------------------------------------------------------
> Noncombatant, n.:
> A dead Quaker.
> -- Ambrose Bierce
>
Lawson
>< Microsoft free environment
This mail client runs on Wine. Your mileage may vary.
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: "Carlo E. Prelz" <[EMAIL PROTECTED]>
Date: Fri, 17 Dec 1999 18:09:00 +0100
Subject: Crosscompiling from linux to a fresh new format
Hello friends. I see the list is very quiet at the moment. I am
looking for a way to crosscompile from Linux/i386 to another operating
system we are developing here at V2 Rotterdam (V2_OS, you may have
heard about it).
I am personally trying to whip up a system to produce executables from
standard Linux tools. I am using Linux GCC, producing .o files, and
then linking them together with ld using a crafted ld script (that
cost me bucketloads of sweat...). And the method is working, with
these two sad exceptions:
1) sometimes I have to lret from a function instead of ret'ing. We
solved the problem with a medium-rare hack (inserting the lret by
force after restoring the stack). But the ideal should be to
declare those subroutines "far" like in old dos days...
2) Memory access happens always in your data segment. We would really
love to be making pointer arithmetics with pointers in other
segments (gs for example - the one that allows you to access to the
whole memory, base address = 0 and limit = 4G). Here too the ideal
things would be to declare those pointers "far" and have them
handled automagically.
I somehow epidermically feel that the only clean way is to do a
complete port of gcc/binutils to the new OS. But that's a huuuge chunk
of work (especially for a person who has very little experience in
this), and we are soooo near to an ideal solution already.
SO it is time to knock at the door of GCC gurus. This is my first
attempt. Maybe a less-linux-specific list is more appropriate, and I'd
like to receive pointers in that directions. Or, maybe, there is an
easy solution to get to our desired goal and you may shed some
light...
Lots of thanks in advance...
- --
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - [EMAIL PROTECTED] che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
------------------------------
From: Great One <[EMAIL PROTECTED]>
Date: Sat, 18 Dec 1999 14:03:07 -0800
Subject: dynamic libraries
hi
Does anybody know:
Is it possible to "export" a C++ class from a library and if how ?
And another thing is that I'm creating a library which
uses functions that I wouldn't like to export. These functions are
members of C++ classes so it isn't possible to make them 'static'.
How can I hide them ?
thank you
------------------------------
From: "Matthias Kleine" <[EMAIL PROTECTED]>
Date: Sat, 18 Dec 1999 21:43:34 +0100
Subject: list-faq?
Hi all!
I�m new to this list and would like to ask if there is any list-faq to
reed. Thanks for any hints.
Matthias
--
SelfLinux http://www.selflinux.de [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED]
Date: Sat, 18 Dec 1999 18:44:59 EST
Subject: Re: list-faq?
<[EMAIL PROTECTED] Thu Dec 16 11:55:19 1999
Date: Thu, 16 Dec 1999 10:09:51 +0000
<From: Richard Adams <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Accessing W98 partition
>=20
> Maybe its time that somebody created a linux-newbie FAQ which=20
> would be sent whenever somebody subscribed to the list, it would=20
> cut down on the amount of questions like this. I would do it but I=20
> don't have nearly enough knowledge about linux.
This list is an "unmoderated list" which means the owner of the list does
not look after it, so if there is a non working owner who is going to do
what you suggest, we as users cant, all we can do is send a message to
the
list-owner and hope he reads it, getting him to add some or other message
wont be a trivial task.
This has also been suggested before, but what can we do;.
There is of course list archives and a FAQ compiled by Ken, Stevens.
http://www.linux-learn.org/faqs
For more information check out the archives at;
http://www.geocrawler.com/lists/3/Linux/47/0
Use the search engine there to find a "Keyword"
Configuration information at;
http://www.linuxtopia.com
What more can i say.
> Simon
>=20
> ICQ:15774994=20
> Evil Overlord Helpful Hints - #07
> When the rebel leader challenges me to fight one-on-one
> and asks "Or are you afraid without your armies to back
> you up?", my reply will be "No, just sensible."
- --=20
Regards Richard
[EMAIL PROTECTED]
http://people.zeelandnet.nl/pa3gcu/
Merry Xmas.
On Sat, 18 Dec 1999, Matthias Kleine wrote:
> Hi all!
>=20
> I=B4m new to this list and would like to ask if there is any list-faq
to
> reed. Thanks for any hints.
>=20
> Matthias
>=20
>=20
> --=20
>=20
> SelfLinux http://www.selflinux.de [EMAIL PROTECTED]
>=20
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: ux36267 <[EMAIL PROTECTED]>
Date: Sun, 19 Dec 1999 18:32:49 -0400 (EDT)
Subject: Fwd
Visit http://www.smrfunding.com and receive a free investment
package in the mail with a free video tape and learn how you can earn
30-40-50 thousand dollars or more in the telecommunication industry
and develop an income for life!
********************************
13798
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 01:46:19 +0100
Subject: Re: Crosscompiling from linux to a fresh new format
> 1) sometimes I have to lret from a function instead of ret'ing. We
> solved the problem with a medium-rare hack (inserting the lret by
> force after restoring the stack). But the ideal should be to
> declare those subroutines "far" like in old dos days...
> 2) Memory access happens always in your data segment. We would really
> love to be making pointer arithmetics with pointers in other
> segments (gs for example - the one that allows you to access to the
> whole memory, base address = 0 and limit = 4G). Here too the ideal
> things would be to declare those pointers "far" and have them
> handled automagically.
>
> I somehow epidermically feel that the only clean way is to do a
> complete port of gcc/binutils to the new OS. But that's a huuuge chunk
> of work (especially for a person who has very little experience in
> this), and we are soooo near to an ideal solution already.
At least part 1) can be done without specific binutils, and minor
modifications to gcc. You could add an attribute to function
declarations, allowing a notation of
int __attribute__((far)) foo(int param)
{
return -param;
}
To implement that, you'll need to modify gcc/config/i386/i386.c. If
done well, that could become a standard extension, available on all
x86 targets. A quick investigation shows that you'll have to modify
the following pieces (looking at GCC mainline code):
- - ix86_valid_type_attribute_p (or ix86_valid_decl_attribute_p?)
- - add the instruction to the machine defintion (i386.md), using
define_insn. If you call it insn, say, "long_return", it will give
you a function gen_long_return().
- - call gen_long_return() inside ix86_expand_epilogue, iff the far
attribute is set for current_function.
Introducing far pointers is a major undertaking; I recommend an
approach similar to what the Linux kernel did (copy_from_fs,
copy_to_fs, ...). The basic problem is that gcc currently does not
support two different pointer types. You could come up with a new
data-type based on TDImode (see (gcc)Machine Modes), but no port
currently uses that feature.
> SO it is time to knock at the door of GCC gurus. This is my first
> attempt. Maybe a less-linux-specific list is more appropriate, and I'd
> like to receive pointers in that directions. Or, maybe, there is an
> easy solution to get to our desired goal and you may shed some
> light...
The gcc list ([EMAIL PROTECTED]) would be the right place for such a
question.
Regards,
Martin
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 01:49:37 +0100
Subject: Re: dynamic libraries
> Is it possible to "export" a C++ class from a library and if how ?
You don't need to export the class from the library, just put it
there.
> And another thing is that I'm creating a library which
> uses functions that I wouldn't like to export. These functions are
> members of C++ classes so it isn't possible to make them 'static'.
> How can I hide them ?
You can make them private.
Regards,
Martin
------------------------------
From: hung <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 18:45:31 +1100 (EDT)
Subject: CORBA
does anyone know any free CORBA compiler for Linux 6.0 (i.e OrbixWeb,
Visibroker,..) ??
Thanks.
Hung.
------------------------------
From: "Bob Stone" <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 11:01:17 -0600
Subject: Missing header files
Missing .h files
Error message when attempting to gcc a .c file:
"In file included from dmfe.c:35:
/usr/i386-glibc20-linux/include/linux/config.h:4:linux/autoconf.h:no such
file or directory"
and
"In file included from dmfe.c:40:
/usr/i386-glibc20-linux/include/linux/module.h:192:linux/version.h:no such
file or directory"
How can I get the required .h files to be available?
Thank you for your help
- ----- Original Message -----
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, December 19, 1999 6:49 PM
Subject: Re: dynamic libraries
> > Is it possible to "export" a C++ class from a library and if how ?
>
> You don't need to export the class from the library, just put it
> there.
>
> > And another thing is that I'm creating a library which
> > uses functions that I wouldn't like to export. These functions are
> > members of C++ classes so it isn't possible to make them 'static'.
> > How can I hide them ?
>
> You can make them private.
>
> Regards,
> Martin
>
------------------------------
From: [EMAIL PROTECTED]
Date: Mon, 20 Dec 1999 14:28:15 +0600 (LKT)
Subject: dynamic array allocation
Hi gurus,
I have a small prob. I wrote a c++ code that had these lines in this order.
...
...
number_of_recs = a/2;
char * recBuf[number_of_recs];
...
...
and the program compiled and ran after compilation with gcc. But my NT
counterpart who is porting my apps couldn't compile it using their compiler
unless he made it a vector instead of an array.
The C++ reference by Stroustrup also prohibits such an assignment. Can someone
please explain why gcc allows it.
TIA
Parthi
PS. Please cc to me as I'm not in the list. THX.
- ----------------------------------
E-Mail: [EMAIL PROTECTED]
Date: 20-Dec-99
Time: 14:20:36
This message was sent by XFMail
- ----------------------------------
------------------------------
From: Kurt Wall <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 15:14:20 -0700
Subject: Re: bsd signals
On Wed, Dec 15, 1999 at 12:45:04AM -0000, Joao Pedras wrote:
> Hello all!
>
> I am in need to run on linux a small app that calls other apps and leaves them
> running in background. What's so special about this ? It is suitable for
> performing this kind of operation from php3 scripts.
> My problem is that this was conceived to work on bsd systems and I have heard
> that bsd signals stuff in linux should be taken into consideration, in order to
> make it work properly on linux. This doesn't perform ok on linux without
> modifications which I am not qualified to perform.
> It compiles ok, but, when I run it, the called app doesn't stay on the
> background.
>
> Here's the code :
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> int main(int argc, char *argv[])
> {
> int pid;
pid_t pid;
> pid=fork();
>
> if (pid!=0)
> {
> pid=setsid();
> close(STDOUT_FILENO);
> close(STDIN_FILENO);
> close(STDERR_FILENO);
I think your logic is at fault. You want to execl() in the child process,
correct? fork() returns 0 in the child, so the correct code would be:
if (pid == 0) {
pid=setsid();
/*
* I would check setsid()'s return and declare another variable to
* store its return value, too.
*/
close(STDOUT_FILENO);
close(STDIN_FILENO);
close(STDERR_FILENO);
execl(argv[1],argv[2],0);
}
> execl(argv[1],argv[2],0);
> }
Um, the argv vector begins at 0. What happens to that argument? As
written, the following will fail:
$ ./a.out ls
and the following will not:
./a.out foobar ls
>
> return 0;
> }
I would also add a check for fork()'s return, since it may fail:
if((pid = fork()) < 0) {
/*
* Handle error here
*/
} elseif(pid == 0) {
/*
* In the child
*/
} else {
/*
* In the parent
*/
}
Kurt
- --
I know that an engineer designed the human body. Who else would put a
waste dispoal plant next to a pleasure center?
------------------------------
From: "Bob Stone" <[EMAIL PROTECTED]>
Date: Mon, 20 Dec 1999 17:09:58 -0600
Subject: Re: dynamic libraries
1. What is a "newly-unpacked kernel source tree (see below)?"
2. We have just installed Linux. Does that mean we have a source tree
installed or do we have to use the source code from the CD?
>/usr/src/linux/include/asm/ is a symbolic link to an architecture-specific
>asm directory--if you have a freshly unpacked kernel source tree, you must
>make symlinks. You'll also find that you may need to do `make config' in a
>newly-unpacked kernel source tree, to create linux/autoconf.h.
>Then, use rm to remove any garbage, and ln to create the links:
rm -rf /usr/include/linux /usr/include/asm
ln -sf /usr/src/linux/include/linux /usr/include/linux
ln -sf /usr/src/linux/include/asm /usr/include/asm
3. What are we linking to where?
4. How can we then do a "make config?"
Thank you.
------------------------------
From: [EMAIL PROTECTED]
Date: Mon, 20 Dec 1999 20:10:57 EST
Subject: Re: dynamic array allocation
Use -pedantic if you want warnings, or -pedantic-errors if you want it
to refuse to compile such code. The rest of us might like gcc as it is.
Have a nice read of info -f gcc Invoking GCC -> Warning Options, or at
least man gcc.
Lawson
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> + "One World, One Web, One Program" - Microsoft Promotional Ad +
> + "Ein Volk, Ein Reich, Ein Fuhrer" - Adolf Hitler +
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
On Mon, 20 Dec 1999 [EMAIL PROTECTED] wrote:
> Hi gurus,
>
> I have a small prob. I wrote a c++ code that had these lines in this
order.
>
> ...
> ...
> number_of_recs = a/2;
> char * recBuf[number_of_recs];
> ...
> ...
>
> and the program compiled and ran after compilation with gcc. But my NT
> counterpart who is porting my apps couldn't compile it using their
compiler
> unless he made it a vector instead of an array.
>
> The C++ reference by Stroustrup also prohibits such an assignment. Can
someone
> please explain why gcc allows it.
>
> TIA
>
> Parthi
>
>
> PS. Please cc to me as I'm not in the list. THX.
>
>
>
> ----------------------------------
> E-Mail: [EMAIL PROTECTED]
> Date: 20-Dec-99
> Time: 14:20:36
>
> This message was sent by XFMail
> ----------------------------------
>
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: [EMAIL PROTECTED]
Date: Mon, 20 Dec 1999 23:13:35 EST
Subject: Re: dynamic libraries
On Mon, 20 Dec 1999, Bob Stone wrote:
> 1. What is a "newly-unpacked kernel source tree (see below)?"
Get the kernel source. Unpack it with
tar -tzf
see man tar.
The kernel folks distribute source as a linux-<V>.<v>.<v>.tar.gz, so
that is how the kernel doco describes it. If you get it as an rpm,
unpack it with rpm. It has a man page too.
>
> 2. We have just installed Linux. Does that mean we have a source tree
> installed or do we have to use the source code from the CD?
>
If you chose to install the kernel source, you have it. If you didn't
you can install it from the CD with whatever install tool is appropriate
for what is on the CD. I don't _know_ what you installed. *NIX is an
attitude, not a monolith.
> >/usr/src/linux/include/asm/ is a symbolic link to an
architecture-specific
> >asm directory--if you have a freshly unpacked kernel source tree, you
must
> >make symlinks. You'll also find that you may need to do `make config'
in a
> >newly-unpacked kernel source tree, to create linux/autoconf.h.
>
> >Then, use rm to remove any garbage, and ln to create the links:
>
> rm -rf /usr/include/linux /usr/include/asm
> ln -sf /usr/src/linux/include/linux /usr/include/linux
> ln -sf /usr/src/linux/include/asm /usr/include/asm
>
> 3. What are we linking to where?
You are linking the names of include directories programs are written to
expect, to the real kernel source files that provide the definitions.
>
> 4. How can we then do a "make config?"
>
cd /usr/src/linux
make config
answer the questions.
If you installed some incarnation of RedHat, I hope you installed
glibc-devel. make config wants to compile some helper programs, and
without glibc-devel, you cannot compile "Hello, world!". You can check
if you installed it with rpm -q glibc-devel, or see what all you
installed with rpm -qa [|less]
> Thank you.
>
De nada
Lawson
One law for the ox, and for the lion, is Opression.
-William Blake
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: [EMAIL PROTECTED]
Date: Tue, 21 Dec 1999 00:27:22 EST
Subject: Re: dynamic libraries
On Mon, 20 Dec 1999 [EMAIL PROTECTED] wrote:
>
>
> On Mon, 20 Dec 1999, Bob Stone wrote:
>
> > 1. What is a "newly-unpacked kernel source tree (see below)?"
>
> Get the kernel source. Unpack it with
>
> tar -tzf
I am not having a good day. that will show you what is in the tarfile.
I meant,
tar -xzf
Lawson
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: "Bas Mevissen" <[EMAIL PROTECTED]>
Date: Tue, 21 Dec 1999 09:53:04 +0100
Subject: Re: Missing header files
- ----- Original Message -----
From: "Bob Stone" <[EMAIL PROTECTED]>
To: "Martin v. Loewis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 20, 1999 18:01
Subject: Missing header files
| Missing .h files
|
| Error message when attempting to gcc a .c file:
|
| "In file included from dmfe.c:35:
| /usr/i386-glibc20-linux/include/linux/config.h:4:linux/autoconf.h:no such
| file or directory"
|
you should configure your kernel to build a autoconfig.h file. So do:
cd /usr/src/linux
make config (or make menuconfig if you prefer)
Then try to build your application again.
Bas.
------------------------------
From: Great One <[EMAIL PROTECTED]>
Date: Tue, 21 Dec 1999 16:13:30 -0800
Subject: so version
hi
how can I create a dynamic library ?
when I use
ar r ...
ranlib ...
I get a static one
thanks
------------------------------
From: [EMAIL PROTECTED]
Date: Tue, 21 Dec 1999 13:16:26 EST
Subject: Re: so version
ld -shared? You might fine info [-f] ld a bit more accessible than the
man page.
Lawson
When in doubt, make it stout, out of things you know about.
On Tue, 21 Dec 1999, Great One wrote:
>
> hi
> how can I create a dynamic library ?
>
> when I use
>
> ar r ...
> ranlib ...
>
> I get a static one
>
> thanks
>
>
>
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
------------------------------
From: Jose Calderon-Celis <[EMAIL PROTECTED]>
Date: Tue, 21 Dec 1999 22:17:36 -0500
Subject: Compile on Linux, and run win95 is possible?
How?
Thanks
Jose Calderon-Celis
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Wed, 22 Dec 1999 13:20:38 +0100
Subject: Re: so version
> how can I create a dynamic library ?
gcc -shared -fPIC -o lib.so source1.c source2.c ...
You need to compile all objects with -fPIC, and you need to link with
gcc -shared.
Good luck,
Martin
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Wed, 22 Dec 1999 13:24:22 +0100
Subject: Re: Compile on Linux, and run win95 is possible?
> How?
You need to install a cross compiler. Configure binutils and gcc for
i386-*-cygwin, and get hold of the cygwin headers and libraries.
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Wed, 22 Dec 1999 13:23:07 +0100
Subject: Re: dynamic array allocation
> The C++ reference by Stroustrup also prohibits such an
> assignment. Can someone please explain why gcc allows it.
This is a variable-length array, see (gcc)Variable Length in the info
pages (under C Extensions). These arrays are also allowed as per
Standard C 99; they are not part of Standard C++ 98.
Regards,
Martin
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Wed, 22 Dec 1999 13:30:29 +0100
Subject: Re: CORBA
> does anyone know any free CORBA compiler for Linux 6.0 (i.e OrbixWeb,
> Visibroker,..) ??
Neither OrbixWeb nor Visibroker is free.
If you are looking for "free in the sense of freedom", have a look at
http://adams.patriot.net/~tvalesky/freecorba.html
If you look for C, I personally recommend ILU; ORBit is another choice.
If you look for C++, I recommend MICO or OmniORB; if you are
interested in "free in the sense of no money", then ORBacus is also a
good choice.
If you look for Python, I recommend Fnorb.
For Java, I don't know what to recommend, although there are a number
of options.
Hope this helps,
Martin
------------------------------
From: Adam Klein <[EMAIL PROTECTED]>
Date: Tue, 04 Jan 2000 07:53:01 -0800
Subject: Fatel signal 11
I am trying to compile the kernel but I get this fatel signal 11 error
when i run :
$ make modules
Here is the version:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
what should i do here is the error:
gcc -D__KERNEL__ -I/usr/src/linux-2.2.12/include -Wall
- -Wstrict-prototypes -O2 -
fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce
- -m386 -DCPU=
386 -DMODULE -DMODVERSIONS -include
/usr/src/linux-2.2.12/include/linux/modversi
ons.h -c -o ip2main.o ip2main.c
gcc: Internal compiler error: program cc1 got fatal signal 11
make[2]: *** [ip2main.o] Error 1
make[2]: Leaving directory `/usr/src/linux-2.2.12/drivers/char'
make[1]: *** [_modsubdir_char] Error 2
make[1]: Leaving directory `/usr/src/linux-2.2.12/drivers'
make: *** [_mod_drivers] Error 2
[root@Masq-Gate linux]# cpp: output pipe has been closed
{standard input}: Assembler messages:
{standard input}:4417: Warning: end of file not at end of a line;
newline insert
ed
{standard input}:6502: Error: no such 386 instruction: `m'
------------------------------
From: Keith Duthie <[EMAIL PROTECTED]>
Date: Tue, 4 Jan 2000 17:16:03 +1300 (NZDT)
Subject: Re: Fatel signal 11
On Tue, 4 Jan 2000, Adam Klein wrote:
> I am trying to compile the kernel but I get this fatel signal 11 error
> when i run :
>
> $ make modules
> what should i do here is the error:
If you are overclocking, you should stop overclocking. If you aren't
overclocking you should have your hardware looked at.
- --
Understanding is a three edged sword. Do you *want* to get the point?
http://www.albatross.co.nz/~psycho/ O- -><-
------------------------------
From: [EMAIL PROTECTED]
Date: Tue, 04 Jan 2000 01:48:55 EST
Subject: Re: Fatel signal 11
On Tue, 4 Jan 2000, Keith Duthie wrote:
> On Tue, 4 Jan 2000, Adam Klein wrote:
>
> > I am trying to compile the kernel but I get this fatel signal 11
error
> > when i run :
> >
> > $ make modules
>
> > what should i do here is the error:
> If you are overclocking, you should stop overclocking. If you aren't
> overclocking you should have your hardware looked at.
>
It is possible that version of the compiler _might_ be buggy. One of
the Wine developers reported that gcc-2.91 generated incorrect
code; switching to gcc-2.95.2 fixed the problem. It's not clear to me
if he was referring to egcs gcc-2.91 or plain gcc-2.91. Personally, I
think anything that will touch c++ code is buggy by definition, but if
you must have c++, get a current version of egcs. :-) Also, have a
read of
http://www.bitwizard.nl/sig11/
for some hints on how to debug your hardware in case it's not the
compiler. gcc is a great tool for finding hardware bugs. For a really
thorough test, see if you can compile the current version of Wine.
You'll need about 200mb of disk space and 64mb virtual (RAM+swap) to
finish the compile.
ftp://metalab.unc.edu/pub/Linux/ALPHA/wine/development/Wine-991212.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-991212.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/Wine-991212.tar.gz
ftp://orcus.progsoc.uts.edu.au/pub/Wine/development/Wine-991212.tar.gz
> --
> Understanding is a three edged sword. Do you *want* to get the point?
> http://www.albatross.co.nz/~psycho/ O- -><-
>
Lawson
>< Microsoft free environment
This mail client runs on Wine. Your mileage may vary.
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk! For your FREE software, visit:
http://dl.www.juno.com/get/tagj.
------------------------------
From: Fenglou Mao <[EMAIL PROTECTED]>
Date: Wed, 5 Jan 2000 15:22:58 +0800 (CST)
Subject: stl question
Hi,all,
Can anyone tell me where I can find an online document about
g++ stl?
Sincerely Yours,
FengLou Mao
*******************************
ADD:Mr. FengLou Mao
Institute of Physical Chemistry
Peking University
BeiJing
P.R.China
Tel:86-10-62756833
Fax:86-10-62751725
------------------------------
From: Raju K V <[EMAIL PROTECTED]>
Date: Wed, 5 Jan 2000 14:07:28 +0530
Subject: Re: stl question
try
http://sourceware.cygnus.com/libstdc++/links.html
R
On Wed, Jan 05, 2000 at 03:22:58PM +0800, Fenglou Mao [[EMAIL PROTECTED]]
wrote:
> Hi,all,
> Can anyone tell me where I can find an online document about
> g++ stl?
>
> Sincerely Yours,
>
> FengLou Mao
> *******************************
> ADD:Mr. FengLou Mao
> Institute of Physical Chemistry
> Peking University
> BeiJing
> P.R.China
> Tel:86-10-62756833
> Fax:86-10-62751725
------------------------------
From: "Matthias Kleine" <[EMAIL PROTECTED]>
Date: Wed, 5 Jan 2000 16:38:32 +0100
Subject: Re: Fatel signal 11
Hi!
Is it true that especially about the AMD K6-2 CPU are reported more
problems than about Intel processors? Does anybody know something about
this?
Bye,
Matthias
--
SelfLinux http://www.selflinux.de [EMAIL PROTECTED]
------------------------------
From: Fenglou Mao <[EMAIL PROTECTED]>
Date: Mon, 10 Jan 2000 21:43:58 +0800 (CST)
Subject: stl const_iterator question.
Hi, all,
I want to use an interator of this type:
set<MyObject, lt<MyObject> >::iterator i;
I think I can use statement like this:
1. (*i).x+=1.0;
or
2. MyObject& t=*i;
But the g++ compiler always think "i" is a const_iterator,
it give error for 1, and warning for 2.
Who can tell me why?
Sincerely Yours,
FengLou Mao
*******************************
ADD:Mr. FengLou Mao
Institute of Physical Chemistry
Peking University
BeiJing
P.R.China
Tel:86-10-62756833
Fax:86-10-62751725
------------------------------
From: Tanner Lovelace <[EMAIL PROTECTED]>
Date: Mon, 10 Jan 2000 16:53:17 -0500
Subject: Re: Fatel signal 11
Matthias Kleine wrote:
>
> Hi!
>
> Is it true that especially about the AMD K6-2 CPU are reported more
> problems than about Intel processors? Does anybody know something about
> this?
>
It is, but only under some circumstances. See this
web page for more info:
http://www.multimania.com/poulot/k6bug.html
- --
Tanner Lovelace Department of Computer Science
[EMAIL PROTECTED] UNC-Chapel Hill, CB #3175
http://www.cs.unc.edu/~lovelace Chapel Hill, NC 27599-3175
------------------------------
From: Rik Hemsley <[EMAIL PROTECTED]>
Date: Tue, 11 Jan 2000 04:17:17 +0000
Subject: Speed of loading shared libs
Hi,
I've recently become very concerned about the speed of application
loading when using certain X11 tookits.
On my travels, I've managed to pick up a fair bit of info, much
of which may have been misleading, or just plain wrong.
I think I may now be asking in the right place. Please correct
me if I'm misguided !
It seems that depending on the toolkit used, different X11 apps
take significantly different amounts of time to begin. By 'begin',
I mean map to the display.
I've checked the initialisation mechanisms of various toolkits
and found they're all practically the same. The delay experienced
before an application maps to the screen seems to take place
_before_ the code begins executing.
So here is my (current) conclusion - that may or may not be correct:
The amount of time it takes for an X11 app to map to the screen
is a function of the amount of symbols in the shared libraries
it loads.
Does this sound reasonable ?
If this is the case, does it mean that ld.so is responsible for
this delay ?
To do a real-world test, I tried creating a 4-line app to create
and map an X11 window. I did this with the GTK and Qt toolkits.
I'm afraid my measurement is only done by perception. If anyone
can tell me how to perform proper measurements, I'll go away
and try again :)
Basically, a GTK app maps to the screen almost instantly. The
delay is imperceptible - the window maps before your finger
leaves the return key.
A Qt app takes significantly longer. On my machine, the delay
seems to be about 1/2 to 1 second.
My attempt at measuring the number of symbols in the libraries
used follows.
I ran objdump --dynamic-syms on the libraries used by two 'hello, world'
apps.
Note: I ignored any extra libs with a tiny number of symbols (libICE, etc)
Qt: libqt
Total symbols: 9927
GTK: libglib libgtk libgdk
Total symbols: 3052
So it looks like libqt has 3 times the number of symbols as the various
GTK-related libraries combined.
I'm not convinced I've worked this out properly - It doesn't
seem quite logical to me that 3 times the number of symbols should
produce such a disparity in load time.
While this doesn't make perfect sense to me, nothing else seems
to add up either. Because I don't know how much of a difference a
large number of symbols makes, I'm asking here !
Am I looking in the right direction, blaming ld.so ? Or should I
look elsewhere ? Any pointers appreciated !
Cheers,
Rik
------------------------------
From: Andreas Jaeger <[EMAIL PROTECTED]>
Date: 11 Jan 2000 15:34:49 +0100
Subject: Re: Speed of loading shared libs
>>>>> Rik Hemsley writes:
Rik> Hi,
Rik> I've recently become very concerned about the speed of application
Rik> loading when using certain X11 tookits.
Rik> On my travels, I've managed to pick up a fair bit of info, much
Rik> of which may have been misleading, or just plain wrong.
Rik> I think I may now be asking in the right place. Please correct
Rik> me if I'm misguided !
Rik> It seems that depending on the toolkit used, different X11 apps
Rik> take significantly different amounts of time to begin. By 'begin',
Rik> I mean map to the display.
Rik> I've checked the initialisation mechanisms of various toolkits
Rik> and found they're all practically the same. The delay experienced
Rik> before an application maps to the screen seems to take place
Rik> _before_ the code begins executing.
Rik> So here is my (current) conclusion - that may or may not be correct:
Rik> The amount of time it takes for an X11 app to map to the screen
Rik> is a function of the amount of symbols in the shared libraries
Rik> it loads.
Rik> Does this sound reasonable ?
Rik> If this is the case, does it mean that ld.so is responsible for
Rik> this delay ?
You can check this yourself if you're using glibc 2.1.x on an i686
compiled for an i686:
$ LD_DEBUG=statistics ls
13661:
13661: runtime linker statistics:
13661: total startup time in dynamic loader: 714186 clock cycles
13661: time needed for relocation: 480435 clock cycles (67.2%)
13661: number of relocations: 289
13661: time needed to load objects: 152416 clock cycles (21.3%)
If glibc was compiled for i386, you only get:
$ LD_DEBUG=statistics ls
13662: number of relocations: 289
But I don't think this shows the problem.
I do advise to start profiling your libs to see where the time is
spend.
Andreas
- --
Andreas Jaeger
SuSE Labs [EMAIL PROTECTED]
private [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED]
Date: Wed, 12 Jan 2000 09:27:06 -0500 (EST)
Subject: Re: Speed of loading shared libs
It's been rumoured that Rik Hemsley said:
>
> The amount of time it takes for an X11 app to map to the screen
> is a function of the amount of symbols in the shared libraries
> it loads.
>
> Does this sound reasonable ?
My gut feel is that this would be totally irrelevent. There is
consdierable intialization that happens within the X server and the X
libs that depends a lot on what the application wants and is doing.
e.g. one applicatino may choose the default visual, another may go
through a long visual selection process. A 'visual' is an x11
abstraction of certain framebuffer/hardware capabilites.
Note also there are buffering issues: X11 protocol is not flushed from
app to server until a variety of events occur. If these don't occur,
or a flush isn't forced by the app, they can sit there indefinietley.
Finally, windows typically do not become visible to the user until
the app calls XMapWindow(); XFlush(); and there are technical &
performance reasons for not dong this asap, but rather, waiting
till late in the initialization process.
Your qt/gtk differences are almost 100% due to how much protocol
the app ant the server exchanged prior to when the x server
received and processed the xMapWindow protocol request element.
We are talking about tens of millions of cpu cycles here; the ld.so
portion of this is a drop in the bucket.
- --linas
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Thu, 13 Jan 2000 07:18:17 +0100
Subject: Re: stl const_iterator question.
> I think I can use statement like this:
>
> 1. (*i).x+=1.0;
>
> or
>
> 2. MyObject& t=*i;
>
> But the g++ compiler always think "i" is a const_iterator,
> it give error for 1, and warning for 2.
>
> Who can tell me why?
If i is a const_iterator, the object referred-to by the iterator is
const, and you must not modify it. If the object is const, then (*i).x
is also const, and you cannot assign to it. Also, *i is of type
"MyObject const &"; you should not assign this to a variable of type
"MyObject&", as this also gives you a way to modify *i, even though *i
is const.
Regards,
Martin
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Thu, 13 Jan 2000 07:09:33 +0100
Subject: Re: Speed of loading shared libs
> Basically, a GTK app maps to the screen almost instantly. The
> delay is imperceptible - the window maps before your finger
> leaves the return key.
>
> A Qt app takes significantly longer. On my machine, the delay
> seems to be about 1/2 to 1 second.
To all the other valid comments, I'd like to add that the choice of
programming language might also have significant impact on
performance. In C++, it is possible to write programs which consume a
lot of processing power, without that effect being directly visible
from the source code. For example, creating and destroying thousands
of objects, or invoking numerous virtual functions would have such an
effect.
It was proposed that the usage of the X protocol in GTK is more
efficient than in Qt. To verify whether this is the case, run both
programs with strace, and count the sheer number of system
calls. Also, count the number of bytes passed to system calls
(especially read and write).
To find out where the time is going inside the libraries, you'd need
to compile both libraries, and the applications, with the -pg option
of gcc(1), and analyse the outcome with gprof(1); this is what was
already recommend when Andreas suggested "profiling".
Regards,
Martin
------------------------------
From: Fenglou Mao <[EMAIL PROTECTED]>
Date: Thu, 13 Jan 2000 23:31:03 +0800 (CST)
Subject: Re: stl const_iterator question.
On Thu, 13 Jan 2000, Martin v. Loewis wrote:
> > I think I can use statement like this:
> >
> > 1. (*i).x+=1.0;
> >
> > or
> >
> > 2. MyObject& t=*i;
> >
> > But the g++ compiler always think "i" is a const_iterator,
> > it give error for 1, and warning for 2.
> >
> > Who can tell me why?
>
> If i is a const_iterator, the object referred-to by the iterator is
> const, and you must not modify it. If the object is const, then (*i).x
> is also const, and you cannot assign to it. Also, *i is of type
> "MyObject const &"; you should not assign this to a variable of type
> "MyObject&", as this also gives you a way to modify *i, even though *i
> is const.
i is not a const_iterator, just an iterator.
Sincerely Yours,
FengLou Mao
*******************************
ADD:Mr. FengLou Mao
Institute of Physical Chemistry
Peking University
BeiJing
P.R.China
Tel:86-10-62756833
Fax:86-10-62751725
------------------------------
From: "Martin v. Loewis" <[EMAIL PROTECTED]>
Date: Fri, 14 Jan 2000 09:31:49 +0100
Subject: Re: stl const_iterator question.
> Yes, for vector, it has no error, but for set, it has errors and
> warnings.
You cannot modify the elements in a set. A set is a container with
unique keys; modifying them might destroy the uniqueness property.
Therefore, set::begin returns a const iterator.
Regards,
Martin
------------------------------
From: Fenglou Mao <[EMAIL PROTECTED]>
Date: Fri, 14 Jan 2000 10:48:56 +0800 (CST)
Subject: Re: stl const_iterator question.
On 11 Jan 2000, Aaron M. Ucko wrote:
> Fenglou Mao <[EMAIL PROTECTED]> writes:
>
> > I want to use an interator of this type:
> >
> > set<MyObject, lt<MyObject> >::iterator i;
> [...]
> > But the g++ compiler always think "i" is a const_iterator,
> > it give error for 1, and warning for 2.
> >
> > Who can tell me why?
>
> set is an _associative container_, which means that it arranges
> elements according to the given comparison functor for efficient
> acces. If you modify elements in place, you might cause them to be
> disarranged, which may cause elements to be lost or even lead to other
> problems.
>
How can I modify an element? copy it out, modify it, erase old one,
insert the new one? It is really an ugly way, and I think the
abstract data-structure "set" don't require programmer to know so
much about the details.
Sincerely Yours,
FengLou Mao
*******************************
ADD:Mr. FengLou Mao
Institute of Physical Chemistry
Peking University
BeiJing
P.R.China
Tel:86-10-62756833
Fax:86-10-62751725
------------------------------
End of linux-gcc-digest V1 #402
*******************************
To subscribe to linux-gcc-digest, send the command:
subscribe linux-gcc-digest
in the body of a message to "[EMAIL PROTECTED]". If you want
to subscribe something other than the account the mail is coming from,
such as a local redistribution list, then append that address to the
"subscribe" command; for example, to subscribe "local-linux-gcc":
subscribe linux-gcc-digest [EMAIL PROTECTED]
A non-digest (direct mail) version of this list is also available; to
subscribe to that instead, replace all instances of "linux-gcc-digest"
in the commands above with "linux-gcc".