Article View: comp.sys.powerpc
Article #3206Re: Debate: PowerMac "trounces" Pentium....???
From: Kevin Brown
Date: Sat, 24 Feb 1996 09:05
Date: Sat, 24 Feb 1996 09:05
70 lines
3689 bytes
3689 bytes
In article <4gaphr$qg8@meaddata.lexis-nexis.com>,
Christopher C. Wood <christw@meaddata.com> wrote:
>In article <kevinbDMyx3u.5C0@netcom.com>, kevin@frobozz.sccsi.com (Kevin Brown) writes:
>|> In article <4g2i5q$dj7@meaddata.lexis-nexis.com>,
>|> Christopher C. Wood <christw@meaddata.com> wrote:
>|> >In article <stephenkDMuGux.Iot@netcom.com>, stephenk@netcom.com (Stephen Knilans) writes:
>
>|> >|> The libraries are there for a REASON! There are possibly HUNDREDS
>|> >|> of number formats, and it is very difficult to provide for all.
>
>|> >Look, I've shown a bunch of things with this thread. _none_ of the
>|> >respondants pointed out that there is a "standard" library call to do
>|> >this: itoa().
>
>|> That's because itoa() is not a standard library call.
>
>It's what the quotes around "standard" were meant to convey. Lots of
>developers treat this as something that is always there; as did I,
>until I used non-bsd systems...
Well, whose fault is that? Not the standard's, that's for sure. You
can't put every possible function into the standard, otherwise the
reference would occupy an entire building. :-)
If your gripe is with the fact that AT&T Unix and BSD Unix are
different, then I partially agree with you. AT&T is largely to blame
here because of their Not Invented Here behavior (what in the world do
you need TLI for when you have BSD sockets?).
>|> > As _assumed_ in Stroustrup, 2nd ed.
>
>|> I don't see it in there at all. What's the page number, and are you
>|> sure they haven't actually implemented it as an example in that book?
>
>I was a tad hasty. Stroustrup uses atoi() on pg. 158 of "The C++
>Programming Language, 2nd Ed, rather than itoa() as I claim. It is
>used, with no reference to header files, or discussion in the text.
Ah. Well, that's different. atoi() *is* in the ANSI C standard, I
believe (don't happen to have K&R 2nd edition...gotta fix that), and I
don't know of any ANSI-compliant implementation these days that
doesn't have it (indeed, such an implementation wouldn't be ANSI
compliant).
>|> >Guess what? This "standard" library call, in actual practice, isn't
>|> >standard.
>
>|> That's because it's not *in* the standard.
>
>Is there a standard way to get a string representation of an integer
>in C or C++?
Sure:
#include <stdio.h>
sprintf ( str, "%d", val );
Of course, if you are trying to build a static executable and don't
want all the baggage that sprintf() gives you, then you'll have to
roll your own (similar to the example I supplied). But the above *is*
a standard way to do it...guaranteed to work on any ANSI-compliant
system.
--
Kevin Brown kevin@frobozz.sccsi.com
This is your .signature virus: < begin 644 .signature (9V]T8VAA(0K0z end >
This is your .signature virus on drugs: <>
Any questions?
Technical Details
Message-ID:
<kevinbDn9vwp.n1M@netcom.com>Path:
arc1-ca.pugleaf.net!netcom.com!kevinbReferences:
<4fqdta$rhh@meaddata.lexis-nexis.com> <4g2i5q$dj7@meaddata.lexis-nexis.com> <kevinbDMyx3u.5C0@netcom.com> <4gaphr$qg8@meaddata.lexis-nexis.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.powerpc,comp.os.linux.advocacy,comp.sys.mac.advocacy,comp.os.os2.advocacy,comp.sys.amiga.advocacy Path: arc1-ca.pugleaf.net!netcom.com!kevinb From: kevin@frobozz.sccsi.com (Kevin Brown) Subject: Re: Debate: PowerMac "trounces" Pentium....??? Message-ID: <kevinbDn9vwp.n1M@netcom.com> Sender: kevinb@netcom4.netcom.com Reply-To: kevin@frobozz.sccsi.com (Kevin Brown) Organization: Frobozzco International References: <4fqdta$rhh@meaddata.lexis-nexis.com> <4g2i5q$dj7@meaddata.lexis-nexis.com> <kevinbDMyx3u.5C0@netcom.com> <4gaphr$qg8@meaddata.lexis-nexis.com> Date: Sat, 24 Feb 1996 09:05:12 GMT X-Original-Newsgroups: comp.sys.powerpc,comp.os.linux.advocacy,comp.sys.mac.advocacy,comp.os.os2.advocacy,comp.sys.amiga.advocacy