On Mon, 24 Jan 2005 05:16:23 +0200, Micha Feigin <[EMAIL PROTECTED]> wrote: > At Mon, 24 Jan 2005 02:45:52 +0200, > Aviv Goll wrote: > > > > hi, > > I'm currently writing an assignment in c++ using g++. > > according to some printouts, during the following lines: > > > > stringstream Fstr; > > fstr<<"blah blah"; > > > > Just tried running just that and had no problem.
that's the whole point, I have the exect same lines ("blah blah.." changed of course) written in about 10 other places in the code (in different methods, no colition with the decleration of Fstr), none of them causes segfault. and about the typo, it exists only in my Emails :-) the program says Fstr<<... > Do notice that in the first > line you define Fstr with a capital F and in the second line with a lower case > f. If this isn't a typo then you may have fstr (lower case) defined elsewhere > as > something that doesn't match. > > I will need to see the whole program (or preferably a minimal sample that > causes > a segmentation fault) to find the problem if this is a typo. > > As for segmentation faults, sensitivity to them depends on implementation and > operating system. The c (and c++) library over allocates memory and then > splits > it out itself between malloc calls (depending on the size of the malloc). Thus > there is memory padding inside the program that can cause the OS not to catch > buffer overruns/underruns. Access to uninitialized pointers should be > caught. Windows (MFC) at least used to do this more then linux. > > Different systems are not equally sensitive. Windows used to be very bed at > catching illegal memory accesses. This has improved with windows 2000/XP, used > to be terrible with 98. When I started my B.A we had quite a few people who > would > write the exercises at home and then compile them on the submission day in > TAU on > the unix machine (pre linux times) and suddenly the program would segfault all > over with things that windows just didn't catch. Made people hate unix (made > me > like it better actually ;-) > > > the seconed line creates a sigmentation fault. > > > > other lines in the project doesn't create such a sig. fault and even > > more weird is that I upload the whole thing to a unix server and it > > didn't produce any faults there. > > > > trying valgrind on linux also didn't produce the mentioned sig. fault > > but produce a lot of other errors which doesn't seem related. > > > > link to valgrind output file: > > http://t2.technion.ac.il/~shtron/out.txt > > > > working from distance on a remote unix is extremely uncomfortable. if > > anyone can help, it'll be great. > > thanks - Aviv > > > > P.S. I tried two different linux machines they both gave sig. fault... > > > > ================================================================= > > To unsubscribe, send mail to [EMAIL PROTECTED] with > > the word "unsubscribe" in the message body, e.g., run the command > > echo unsubscribe | mail [EMAIL PROTECTED] > > > > > > +++++++++++++++++++++++++++++++++++++++++++ > > This Mail Was Scanned By Mail-seCure System > > at the Tel-Aviv University CC. > > > ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]