From 1623064573320245899
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,ef92157550fe04a1
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2000-10-30 12:15:05 PST
Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!news.tele.dk!194.176.220.129!newsfeed.icl.net!dispose.news.demon.net!demon!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: James.Kanze@dresdner-bank.com
Newsgroups: comp.std.c++
Subject: Re: snprintf/vsnprintf
Date: Mon, 30 Oct 2000 20:14:38 GMT
Organization: Deja.com - Before you buy.
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <8tk4lf$ks8$1@nnrp1.deja.com>
References: <zQ0L5.41331$KI6.8171531@typhoon.snet.net>
X-Trace: mail2news.demon.co.uk 972936885 mail2news:10354 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Article-Creation-Date: Mon Oct 30 15:38:25 2000 GMT
X-Http-User-Agent: Mozilla/4.72 [en] (WinNT; I)
X-Http-Proxy: 1.0 x52.deja.com:80 (Squid/1.1.22) for client 193.194.7.71
X-MyDeja-Info: XMYDJUIDkanze
Lines: 33
Xref: supernews.google.com comp.std.c++:1748

In article <zQ0L5.41331$KI6.8171531@typhoon.snet.net>,
  "Timur Aydin" <taydin@snet.net> wrote:

> These are the safe versions of the standard "sprintf" and "vsprintf"
> and exist in the runtime libraries of some compilers. In addition to
> the arguments of the standard functions, these take an additional
> argument that specifies the size of the destination buffer to
> prevent writing beyond the end of the buffer. I think it would be
> beneficial to have this function part of the C and C++ standard
> specified. Here are some reasons:

In C++, you would normally use an ostringstream, rather than sprintf,
so the problem doesn't occur.  In C, you would normally use snprintf,
so the only problems are those typical of the printf family in general
(no type checking, no extensibility to user defined types...).

--
James Kanze                               mailto:kanze@gabi-soft.de
Conseils en informatique orient�e objet/
                   Beratung in objektorientierter Datenverarbeitung
Ziegelh�ttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



