This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reg: Deletion of char ptr resulting in segmentation fault - Double to string convertion


Questions not related to GCC should be written to gcc-help@ - and not to gcc-bugs@. While bugs should be submitted via Bugzilla.

emailstorbala wrote:
	double num = 23e45;

	buffer = new char[sizeof(double) + 1];

Here you allocate 9 bytes.

		sprintf(buffer, "%lf", num);

And here you are writing the string "23000000000000000602806197963719130677638070272.000000", which is longer than 8 characters.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]