* Stray pointers
@ 2004-03-23 14:58 bruno
2004-03-23 15:15 ` Eljay Love-Jensen
0 siblings, 1 reply; 5+ messages in thread
From: bruno @ 2004-03-23 14:58 UTC (permalink / raw)
To: gcc-help
Hi,
I was thinking about some problems involving programs written in c/c++ and
I don't realize why the compilers don't initialize every created pointer
to zero. Deleted pointers also are not automaticaly reassigned to zero
resulting in stray or dangling pointers (if the programmer do not take
care), and finally in possible crashes. Why this lack? Performance?
Thanks in advance,
Bruno A. Costa
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Stray pointers
2004-03-23 14:58 Stray pointers bruno
@ 2004-03-23 15:15 ` Eljay Love-Jensen
2004-03-23 18:01 ` Building gcc on Tru64 laurence
0 siblings, 1 reply; 5+ messages in thread
From: Eljay Love-Jensen @ 2004-03-23 15:15 UTC (permalink / raw)
To: bruno, gcc-help
Hi Bruno,
Correct. Performance.
So always do this when declaring a pointer:
Foo* pFoo = NULL; // or else "= new Foo"
And do this when deleting a pointed to object:
delete pFoo;
pFoo = NULL;
...unless you've determined (via profiling) the performance penalty is too
high for your application.
Or try to use std::auto_ptr to help with your pointer resource management.
Except when the performance penalty is too high for your application.
Or considering using one of the more memory management friendly languages,
such as Java. (That's "friendly" in the sense of "safe and easy; one less
thing to worry about".)
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 5+ messages in thread
* Building gcc on Tru64
2004-03-23 15:15 ` Eljay Love-Jensen
@ 2004-03-23 18:01 ` laurence
2004-03-26 4:20 ` llewelly
0 siblings, 1 reply; 5+ messages in thread
From: laurence @ 2004-03-23 18:01 UTC (permalink / raw)
To: gcc-help
Dear all,
I was wondering if anyone could help me in my attempts to build gcc
on Tru64 (Tru64 5.0, ev6). From looking at bug-reports, it seemed to me
that the gcc-3.3 branch does not build on Tru64; since my attempts
seemed to confirm this, I decided to try the gcc-3.4 branch. I can get
the compilers (c and c++) to build without failing using the following:
CC=/usr/bin/cc ../gcc/configure --prefix=/usr/local/gcc-3.4-20040322
--program-suffix=-3.4-20040322 --enable-languages=c,c++
--enable-version-specific-runtime-libs --disable-nls
However, when I try to compile some c++ programs, such as those included in
Lam MPI, I get runtime errors complaining that "_Ewcsftime" is undefined
in libstdc++. I have also built gcc using --disable-shared and then get
the errors while linking the programs.
I can find very little information about _Ewcsftime. I did find
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00495.html
and had a look at the wchar.h file from Compaq, which mentions
_Ewcsftime, and was wondering where else it might crop up. I was also
wondering if anyone could tell me if _Ewcsftime is supposed to be
defined in libstdc++ or if it is in some other library.
--
Laurence
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Building gcc on Tru64
2004-03-23 18:01 ` Building gcc on Tru64 laurence
@ 2004-03-26 4:20 ` llewelly
2004-03-31 13:03 ` laurence
0 siblings, 1 reply; 5+ messages in thread
From: llewelly @ 2004-03-26 4:20 UTC (permalink / raw)
To: laurence; +Cc: gcc-help
laurence@narya.org writes:
> Dear all,
> I was wondering if anyone could help me in my attempts to build gcc
> on Tru64 (Tru64 5.0, ev6). From looking at bug-reports, it seemed to me
> that the gcc-3.3 branch does not build on Tru64; since my attempts
> seemed to confirm this, I decided to try the gcc-3.4 branch. I can get
> the compilers (c and c++) to build without failing using the following:
>
> CC=/usr/bin/cc ../gcc/configure --prefix=/usr/local/gcc-3.4-20040322
> --program-suffix=-3.4-20040322 --enable-languages=c,c++
> --enable-version-specific-runtime-libs --disable-nls
>
> However, when I try to compile some c++ programs, such as those included in
> Lam MPI, I get runtime errors complaining that "_Ewcsftime" is undefined
> in libstdc++. I have also built gcc using --disable-shared and then get
> the errors while linking the programs.
>
> I can find very little information about _Ewcsftime. I did find
>
> http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00495.html
>
> and had a look at the wchar.h file from Compaq, which mentions
> _Ewcsftime, and was wondering where else it might crop up. I was also
> wondering if anyone could tell me if _Ewcsftime is supposed to be
> defined in libstdc++ or if it is in some other library.
Here is a shot in the dark. Use find, nm, and grep, like this:
find /usr/lib -name '*lib*so*' -print | xargs nm -A | & grep 'T.*_Ewcsftime.*' | less
Replace '/usr/lib' with the directories in which you expect to find libraries.
Replace '*lib*so*' with a pattern which you expect to match appropriate
libraries.
-A is the gnu nm option to print the name of the file before each
symbol. Look at the docs for your nm to find an equivalent.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Building gcc on Tru64
2004-03-26 4:20 ` llewelly
@ 2004-03-31 13:03 ` laurence
0 siblings, 0 replies; 5+ messages in thread
From: laurence @ 2004-03-31 13:03 UTC (permalink / raw)
To: gcc-help
On Thu, 25 Mar 2004 llewelly@xmission.com wrote:
> laurence@narya.org writes:
> > I was wondering if anyone could help me in my attempts to build gcc
> > on Tru64 (Tru64 5.0, ev6). From looking at bug-reports, it seemed to me
> > that the gcc-3.3 branch does not build on Tru64; since my attempts
> > seemed to confirm this, I decided to try the gcc-3.4 branch.
<snip>
> > However, when I try to compile some c++ programs, such as those included in
> > Lam MPI, I get runtime errors complaining that "_Ewcsftime" is undefined
> > in libstdc++. I have also built gcc using --disable-shared and then get
> > the errors while linking the programs.
<snip>
> > and had a look at the wchar.h file from Compaq, which mentions
> > _Ewcsftime,
<snip>
> Here is a shot in the dark. Use find, nm, and grep, like this:
>
> find /usr/lib -name '*lib*so*' -print | xargs nm -A | & grep 'T.*_Ewcsftime.*' | less
Thanks - though it didn't seem to find anything for me, I'm afraid.
However I have now managed to get an apparently working compiler by
using the snapshot of 3.4 from 7th January. I'm quite satisfied with
this; however, I am a bit curious as to what might have happened in the
meantime (or what I've done to my system to cause this). One difference I
have noticed is that the snapshot from the 7th January did not create a
new wchar.h file (which I mentioned in my previous post). Perhaps I shall
try playing with the latest compiler source and see what I can find.
--
Laurence
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-31 8:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 14:58 Stray pointers bruno
2004-03-23 15:15 ` Eljay Love-Jensen
2004-03-23 18:01 ` Building gcc on Tru64 laurence
2004-03-26 4:20 ` llewelly
2004-03-31 13:03 ` laurence
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).