From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Alternative to fcvt for older DJGPP? Date: 4 Aug 2003 15:31:31 GMT Organization: Aachen University of Technology (RWTH) Lines: 23 Message-ID: References: <76uzeozd7s3g.1sgoajp58hmqa$.dlg AT 40tude DOT net> <1sb2cgsjrn9c1.1qat04crl2pqh$.dlg AT 40tude DOT net> <15oavr9z6uf0m$.1l1oz07obzrud DOT dlg AT 40tude DOT net> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1060011091 11644 137.226.32.75 (4 Aug 2003 15:31:31 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 4 Aug 2003 15:31:31 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Quasar wrote: [...] > question here is a "portable" snprintf implementation which I have added > recently because some of my target platforms totally lack or have > questionable implementations of snprintf and vsnprintf. It uses the > fcvt function in one place in its double formatting code. A truly portable snprintf() implementation is impossible, at close to 100% certainly level. The need to use utterly unportable functions like fcvt() is just one symptom of that fact. In other words: you're driving out Baal by invoking Beelzebub. If you need snprintf(), but there is none in the platform's libc that you can use, you're toast. Period. This is of course the actual reason why snprintf() was added to C99 in the first place. Only a compiler implementor (in this case: the DJGPP team) can write a complete and efficient implementation of snprintf(). User code generally can't. Floating point stuff is the main obstacle here, but integers can be surprisingly hairy to get right, too. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.